SQL Important Commands:

SQL Important Commands:

Here is the list of some important SQL Commands:

Commands Descriptions

SELECT: Used to retrieve data from a database.

INSERT: Adds new records or rows to a table.

UPDATE: Modifies existing records in a table.

DELETE: Removes records from a table.

CREATE TABLE: Creates a new table in the database.

ALTER TABLE: Modifies an existing table structure.

DROP TABLE: Deletes a table from the database.

CREATE INDEX: Creates an index on a table column to speed up data retrieval.

DROP INDEX: Removes an index from a table.

CREATE VIEW: Creates a virtual table based on the result of a SQL statement.

DROP VIEW: Deletes a view from the database.

INSERT INTO SELECT: Inserts data from one table into another based on a query.

TRUNCATE TABLE: Removes all records from a table, but keeps the table structure intact.

ALTER TABLE ADD CONSTRAINT: Adds a constraint to a table after it has been created.

GRANT: Gives specific privileges to database users.

REVOKE: Removes specific privileges from database users.

COMMIT: Saves all changes made since the last commit.

ROLLBACK: Discards all changes made since the last commit.

BEGIN TRANSACTION: Starts a new transaction.

SET TRANSACTION: Sets characteristics for the transaction

 

To view or add a comment, sign in

More articles by Sampath Medara

Explore content categories