SQL Commands with Syntax and Examples
SQL Commands:
SQL commands are instructions that is used to communicate with the database. It is also used to perform specific tasks, functions, and queries of data. It can perform various tasks like creating a table, adding data to tables, dropping the table, modifying the table, and setting permission for users.
SQL Commands with Syntax:
INSERT OPERATION:
INSERT command is used to insert data into the row of a table. After creating the tables, namely EMPLOYEE and DEPARTMENT, we shall insert data values into them using SQL command. It has the following syntax:
INSERT INTO VALUES(, , ...);
SELECT Command:
SELECT command is used to retrieve the data from a table. This command also provides query capability. SELECT command is the same as the projection operation of relational algebra. It has the following syntax:
SELECT * FROM ;
UPDATE OPERATION:
UPDATE is an SQL verb that changes or modifies the data values in a table. It has the following syntax:
UPDATE SET [WHERE ];
DELETE OPERATION:
You can remove rows from a table with the command DELETE. This command removes specific rows meeting the condition and not the individual field values. It has the following syntax:
UPDATE FROM WHERE ;
To remove all the contents of a table, you would enter the following statement:
DELETE FROM ;