Use of ALIASES operator in SQL

Use of ALIASES operator in SQL: (1) “ALIASES” operator is used to give a temporary name to column and table. Aliases are mostly used to make column names more readable. (2) Syntax of “ALIASES” statement is: SELECT column1 AS alias_name, column2 AS alias_name, …FROM table_name (3) Let’s take an example to give a temporary name to a column …

Use of BETWEEN Operator in SQL

Use of BETWEEN Operator in SQL: (1) “BETWEEN” operator is used to get values within the specified range. (2) Syntax of “BETWEEN” statement is: SELECT column1, column2, …FROM table_nameWHERE column1 BETWEEN value1 AND value2; (3) Let’s take an example to get records according to the “No.” column is equal to the assigned values as shown. (4) Select the …

Use of IN operator in SQL

Use of IN operator in SQL: (1) “IN” operator is used where multiple conditions are executed. It is a shortcut of the “OR” operator. It is used with the “WHERE” clause. (2) Syntax of “IN” statement is: SELECT column1, column2, …FROM table_nameWHERE column1 IN (value1,value2… valueN); (3) Let’s take an example to get records according to the “Country …

Use of SELECT TOP Statement in SQL

Use of SELECT TOP Statement in SQL: (1) “SELECT TOP” statement is used to get a specific number of records. (2) Syntax of “SELECT TOP” statement is: SELECT TOP number column1, column2, …FROM table_name; (3) Let’s take an example to get specify records from the Vendor table as shown. (4) Select the database in the SQL server and click …

Use of CREATE DATABASE Statement in SQL

Use of CREATE DATABASE Statement in SQL: (1) “CREATE DATABASE” statement is used for creating a new database. (2) Syntax of “CREATE DATABASE” statement is: CREATE DATABASE databasename;CREATE DATABASE databasename ON PRIMARY (Name =N’Databasename_Data’,FILENAME= N’Pathe’)LOG ON (Name = N’Databasename_Log’,FILENAME= N’Pathe’); (3) Let’s create two databases in the below examples. One is created in by default path …

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 …