SQL Server: Microsoft SQL Server is a relational database management system developed by Microsoft. As a database server, it is a software product with the primary function of storing and retrieving data as requested by other software applications—which may run either on the same computer or on another computer across a network.
It’s strongly recommended to use any command-line tool(CLI) like terminal, cmd to run following queries and commands.
Before getting started MS SQL Server should be installed in the local system.
- Hit listed command to get connect with SQL Server.
sqlcmd -S localhost -U SA -P "<password>"
- Issue listed queries to create a database name called ‘geek’.
> CREATE DATABASE geek; > GO
- To use created data issue listed queries.
> Use <your database name>; > GO
- Issue listed queries to create a table name called ‘student’ with three fields id, firstname and lastname.
> CREATE TABLE student (id INT, firstname NVARCHAR(30), lastname NVARCHAR(30)); > GO
- Issue listed queries to insert some values into table ‘student’.
> INSERT INTO student VALUES (1, 'Stephen', 'Hawking'); > INSERT INTO student VALUES (2, 'Isaac', 'Newton'); > INSERT INTO student VALUES (3, 'Chandrasekhara Venkata', 'Raman'); > GO
- To check entries of table issue listed queries.
> SELECT * from student; > GO
Before getting started Node.js should be installed in the local system.
- To create Node.js environment issue following command.
- Express allows us to set up middlewares to respond to HTTP Requests.
npm install express --save
- Microsoft SQL Server client give us functionality to connect with SQL server.
npm install mssql --save
To begin with Node.js part, we need to create our server file server.js in our local system.
Run server.js file using the following command:
After executing the above command, you will see the following output on your console:
Server is listening at port 5000...
Now hit the url http://localhost:5000/ in the local browser.
- How to connect the Database with PHP DOM page ?
- Difference between Web Browser and Web Server
- Create a database on Relational Database Service (RDS) of Amazon Web Services(AWS)
- PHP program to fetch data from localhost server database using XAMPP
- Difference Between Web server and Application server
- Difference between Apache Tomcat server and Apache web server
- How to Set Online SQL Server for Node.js ?
- How to open a PDF files in web browser using PHP?
- How to give a div tag 100% height of the browser window using CSS
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.