Author: sqltutorial_wmkd8s

Inner Join

SQL INNER JOIN An inner join is a join in which the values in the columns being joined are compared using a comparison operator. SQL Inner Join syntax SELECT column_name(s) FROM A_table INNER JOIN B_table ON A_table.column_name = B_table.column_name; Training_Course ID...

Check Constraint

SQL Check Constraint A SQL Check constraint enforce domain integrity by limiting the values that are accepted by one or more columns. Multiple CHECK constraints can be created for a single column. Also you can create a single CHECK constraint to...

Unique Constraint

SQL Unique Constraint A SQL Unique constraint verifies that no duplicate values are inserted in a specific columns that do not participate in a primary key. A UNIQUE constraint can be referenced by a FOREIGN KEY constraint. UNIQUE constraints allow for...

Foreign Key Constraint

SQL Foreign Key Constraint A SQL Foreign Key constraint is a column or combination of columns that is used to create link between the data in two tables. When a value other than NULL is entered into the column of a...

Primary Key Constraint

SQL Primary Key Constraint A SQL Primary Key constraint is a column or a combination of several columns that contain values that uniquely identify each row in the table. A table can contain only one PRIMARY KEY constraint. A primary key...

Truncate table

SQL Truncate table To truncate a table from database uses the command TRUNCATE TABLE. Truncate removes all rows from a table. Truncate command is used without any clauses. When the Truncate command is executed, the table is locked automatically. SQL Truncate...

Drop table

SQL Drop table To drop a table from database uses the command DROP TABLE. SQL Drop table syntax DROP TABLE my_table_name; Example CREATE TABLE lessons ( ID INT PRIMARY KEY, TITLE VARCHAR(250) NOT NULL, ); DROP TABLE lessons;...

Alter table

SQL Alter table To add, modify, delete a column from a table uses the command ALTER TABLE. SQL Add Column syntax ALTER TABLE my_table ADD new_column_name data_type; SQL Alter Column syntax ALTER TABLE my_table ALTER COLUMN column_name new_data_type; SQL Drop Column...

Having

SQL HAVING HAVING is used in select similar like WHERE or when the state of a select uses an aggregate function. Syntax SELECT name_of_column, function(name_of_column) FROM name_of_table GROUP BY name_of_column HAVING function(name_of_column) operator value Example Orders ID NAME PRICE 1 Learn...

Group By

SQL GROUP BY The GROUP BY is used when aggregate functions exists in the select. The aggregate functions are: count, max, min, sum, avg. Syntax SELECT name_of_column, function(name_of_column) FROM name_of_table GROUP BY name_of_column Example Orders ID NAME PRICE 1 Learn Python...