Unique Keyword in SQL
The UNIQUE keyword is used to retrieve the unique records by eliminating the all duplicate records. Syntax: UNIQUE and DISTINCT statements are the same and will give the same result sets. Example: Output:
Select Query in SQL
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: Example: Output: Syntax of SELECT to fetch specific columns: SELECT column1, column2, column FROM tableName; Example: Output:
Update Query in SQL
The UPDATE statement is used to modify the existing record in a table. Syntax: Use where condition if you want to update a specific record otherwise all records will update. Example: Output:
Index Constraint in SQL
The INDEX is used to create and retrieve data from the table very quickly. An INDEX is created with CREATE INDEX statement. Syntax: Drop an INDEX Constraint: Use the following syntax to drop an index constraint.
Insert Query in SQL
The INSERT statement is used to insert a new record into the table. Ways to insert the data into a table: Inserting the data directly to a table. Inserting data to a table through a select statement. 1. Inserting the data directly to a table. In case we insert the values in the specified columns.Syntax: […]
Unique Constraint in SQL
The UNIQUE constraint is used to uniquely identify each row in a table. It is like a primary key but it can contain one null value and a table can have more than one UNIQUE constraint. Syntax of UNIQUE Constraint on one column with CREATE TABLE statement: MySQL: SQL Server / Oracle / MS Access: […]
Not Null Constraint in SQL
The NOT NULL constraint enforces a field or column to not contain a null value. Example of NOT NULL constraint with CREATE TABLE statement: Example of NOT NULL constraint with ALTER TABLE statement:
Foreign Key Constraint in SQL
The FOREIGN KEY is used to define a relationship between two tables and a FOREIGN KEY in one table points to the PRIMARY KEY in another table. Syntax of FOREIGN KEY Constraint on one column with CREATE TABLE statement: MySQL: SQL Server / Oracle / MS Access: Syntax of FOREIGN KEY Constraint on one column […]