SQL NOT BETWEEN Operator

The BETWEEN operator is used to select values within a range. The values can be numbers, dates or text. Syntax: SELECT * FROM tableName WHERE columnName NOT BETWEEN value1 AND value2; The value of the conditioned column should not be in the given range specified by NOT BETWEEN operator. Example: SELECT * FROM EMPLOYEE WHERE … Read more

Categories SQL

SQL BETWEEN Operator

The BETWEEN operator is used to select values within a range. The values can be numbers, dates or text. Syntax: SELECT * FROM tableName WHERE columnName BETWEEN value1 AND value2; The value of the conditioned column should be in the given range specified by BETWEEN operator. Example: SELECT * FROM EMPLOYEE WHERE SALARY BETWEEN 40000 … Read more

Categories SQL

SQL NOT IN Operator

The NOT IN operator is used to reduce the multiple or conditions by specifying the multiple values in a where clause. Syntax: SELECT * FROM tableName WHERE columnName NOT IN (value1,value2,… valueN); The value of the conditioned column should not be equal to the any of the specified values in the NOT IN operator. Example: … Read more

Categories SQL

SQL SELECT IN Operator

The IN operator is used to reduce the multiple or conditions by specifying the multiple values in a where clause. Syntax: SELECT * FROM tableName WHERE columnName IN (value1,value2,… valueN); The value of the conditioned column should be equal to the any one of the specified values in the IN operator. Example: SELECT * FROM … Read more

Categories SQL

SQL SELECT TOP

The SELECT TOP statement is used to retrieve the top specified number of rows from a table. Syntax: SELECT TOP n * FROM tableName Where n is the number of rows. Example: SELECT TOP 2 * FROM EMPLOYEE;SELECT TOP 2 * FROM EMPLOYEE; Output: EMP_ID EMP_NAME AGE SALARY 1 Parbhjot 28 35000 5 Parmender 28 45000EMP_ID EMP_NAME AGE SALARY 1 … Read more

Categories SQL

SQL DISTINCT keyword

The DISTINCT keyword is used to retrieve the unique records by eliminating the all duplicate records. Syntax: SELECT DISTINCT column1, column2,…..columnN FROM tableName WHERE [condition] Example: SELECT DISTINCT EMP_NAME FROM EMPLOYEE;SELECT DISTINCT EMP_NAME FROM EMPLOYEE; Output: EMP_NAME Nidhi Parbhjot ParmenderEMP_NAME Nidhi Parbhjot Parmender   Next Topic: SQL SELECT TOP with example. Previous Topic: SQL UNIQUE … Read more

Categories SQL

SQL UNIQUE keyword

The UNIQUE keyword is used to retrieve the unique records by eliminating the all duplicate records. Syntax: SELECT UNIQUE column1, column2,…..columnN FROM tableName WHERE [condition] UNIQUE and DISTINCT statements are same and will give the same result sets. Example: SELECT UNIQUE EMP_NAME FROM EMPLOYEE;SELECT UNIQUE EMP_NAME FROM EMPLOYEE; Output: EMP_NAME Nidhi Parbhjot ParmenderEMP_NAME Nidhi Parbhjot … Read more

Categories SQL

SQL SELECT

The SELECT statement is used to retrieve the data from a database table in the form of result sets. Syntax of SELECT to fetch all columns: SELECT * FROM tableName; Example: SELECT * FROM EMPLOYEE;SELECT * FROM EMPLOYEE; Output: EMP_ID EMP_NAME AGE SALARY 1 Parbhjot 28 35000 5 Parmender 28 45000 2 Parmender 30 45000 … Read more

Categories SQL

SQL UPDATE statement

The UPDATE statement is used to modify the existing record in a table. Syntax: UPDATE tableName SET columnName1 = value1, columnName2 = value2,…, columnNameN = valueN WHERE [condition] Use where condition if you want to update a specific record otherwise all records will update. Example: UPDATE EMPLOYEE SET EMP_NAME = ‘Parmender’ WHERE EMP_ID = ‘5’;UPDATE … Read more

Categories SQL

SQL INDEX Constraint

The INDEX is used to create and retrieve data from the table very quickly. An INDEX is created with CREATE INDEX statement. Syntax: CREATE INDEX indexName ON tableName (column1, column2…..);  Drop an INDEX Constraint: Use the following syntax to drop an index constraint. ALTER TABLE tableName DROP INDEX indexName;   Next Topic: SQL INSERT statement … Read more

Categories SQL