Category: SQL

Use of OR Operator in SQL

Use of OR Operator in SQL: (1) “OR” operator is used where multiple conditions are executed. It shows records if any of the condition is true. (2) Syntax of “OR” statement is: SELECT DISTINCT column1, column2, …FROM table_nameWHERE Cond1 OR Cond2 OR CondN; (3) Let’s take an example to get records according to the “No.” & “Country Region Code” …

Use of AND operator in SQL

Use of AND operator in SQL: (1) “AND” operator is used where two conditions are executed. It shows records when all conditions are true. (2) Syntax of “AND” statement is: SELECT DISTINCT column1, column2, …FROM table_nameWHERE Cond1 AND Cond2 AND CondN; (3) Let’s take an example to get records according to the “No.” & “Address” columns are equal to …

SQL ORDER BY Statement

SQL ORDER BY Statement: (1) “ORDER BY” statement used for sorting records in the table from the database. (2) Syntax of “ORDER BY” statement is: SELECT DISTINCT column1, column2, …FROM table_nameORDER BY Col1, Col2….; (3) Let’s take an example to sort records according to the “Address” column in the “Vendor table”. (4) Select the database in the SQL server …

SQL WHERE Statement

SQL WHERE Statement: (1) “WHERE” statement use for filtering records in table from database. (2) Syntax of “WHERE” statement is: SELECT DISTINCT column1, column2, …FROM table_nameWHERE condition; (3) Lets take an example to select only values from the “Country_Region Code” column in the “Vendor table” according to the condition. (4) Select database in SQL server and click on “New …

SQL SELECT DISTINCT Statement

SQL SELECT DISTINCT Statement: (1) “SELECT DISTINCT” statement used to select unique records in the table from the database. (2) Syntax of “SELECT DISTINCT” statement is: SELECT DISTINCT column1, column2, …FROM table_name; (3) Let’s take an example to select only distinct/unique values from the “Country_Region Code” column in the “Vendor table”. (4) Select the database in the SQL server …

How to convert SQL Query into JSON Format in SQL Server

Convert SQl Query into JSON Format in SQL Server: (1) “SELECT” statement used for select records in table form database. (2) Syntax of “SELECT” statement is: SELECT column1, column2, …FROM table_name for JSON AUTO; (3) Let’s take an example to select records for “Vendor table” and show them in “JSON” format. (4) Select the database in the SQL server …

How to Install SQL Management Studio

Install SQL Management Studio: (1) Go to the folder where SQL Management Studio setup is saved as shown in Fig. (2) Select SSMS-Setup-ENU and right-click on the setup and select the option “Run as administrator” as shown in Fig. (3) After doing the above steps, a new window is open and choose the option “Install” as …

How to Create New Database in Microsoft SQL Server

Create New Database in Microsoft SQL Server: STEP-01: Open Microsoft SQL Server. STEP-02: In Object Explorer, connect to an instance of the SQL Server Database Engine and then expand that instance. Right-click on DATABASE and select the option “New Database” STEP-03: Enter the name of the Database. To create the database by accepting all default values, click OK. …