IT3A-2016 / LineTech

0 stars 0 forks source link

Research about connection to database and sorting and grouping of data #7

Closed anjadriano16 closed 7 years ago

DennisJames25 commented 7 years ago

Creating a Data Connection to a SQL Server Database To create a data connection to a SQL Server database

  1. In Server Explorer/Database Explorer click Connect to Database.
  2. In the Choose Data Source dialog box, select Microsoft SQL Server, and then click OK. If the Add Connection dialog box opens, and the Data source is not Microsoft SQL Server, click Change to open the Choose/Change Data Source dialog box. For more information, see Choose/Change Data Source Dialog Box.
  3. Select a server name from the drop-down list, or type the name of the server where the database you want to access is located.
  4. Based on the requirements of your database or application, select either Windows Authentication or use a specific user name and password to log on to the SQL Server (SQL Server Authentication). For more information, see Add/Modify Connection (Microsoft SQL Server).
    1. Select the database you want to connect to from the drop-down list.
    2. Click OK.

Sorting in SQL:

Order By clause sort the result set from the query (with a where clause) in a specific order using the ORDER BY clause based on specified column(s).

Syntax:

Here is the syntax of Order By clause in SQL.

[code lanuage=”sql”] Select columns From tables Where Order By column ASC/DSC; ASC option sort the data in Ascending order and DSC option sort the selected data in Descending Order.

Grouping in SQL:

SQL Group By clause is used to retrieve data grouped according to one or more columns.

Syntax:

Here is the syntax of Group By clause in SQL.

[code lanuage=”sql”] Select columns From tables GROUP BY column;