In SQL, to perform operations like create, delete, update, drop, truncate, insert, etc., operations on databases, tables, and stored procedures, we need to follow some of the predefined syntax formats.
Following are some basic SQL statements to perform operations like insert, update, delete, select on databases, tables, etc., based on our requirements.
Statement | Description |
---|---|
CREATE DATABASE | This statement is useful to create a new database in sql. |
ALTER DATABASE | By using this statement, we can alter or modify existing database details. |
DROP DATABASE | This statement is useful to drop or delete an existing database in sql. |
CREATE TABLE | This statement is useful to create a new table in sql. |
ALTER TABLE | This statement is useful to modify existing tables in sql. |
DELETE TABLE | This statement is useful to delete records from tables in sql. |
DROP TABLE | This statement is useful to drop the complete table from sql database. |
CREATE INDEX | This statement is useful to create an index on the table. |
DROP INDEX | This statement is useful to drop an existing index on the table. |
INSERT INTO | This statement is useful to insert data into tables. |
SELECT | This statement is useful to get data from tables. |
UPDATE | This statement is useful to update the records in a table. |
CREATE PROCEDURE | This statement is useful to create a new stored procedure in sql database. |
ALTER PROCEDURE | This statement is useful to modify an existing stored procedure in sql database. |
DROP PROCEDURE | This statement is useful to delete an existing stored procedure in sql database. |
The following are the syntaxes of the above sql statements to perform required operations in sql server.
Following is the syntax of creating a new database in sql server.