SQL Commands practically simplified – find out here

SQL (Structured Query Language) is a programming language that is used to interact with relational databases. It is used to organize, manage, and retrieve data stored in databases. SQL commands are specific keywords or statements that developers use to work with data stored in relational databases.

Here are some examples of SQL commands:

  • CREATE: creates a new table, a view of a table, or other object in the database.

CREATE TABLE Employees (
employee_ID int,
last_name varchar(255),
first_name varchar(255)
);

 

  • ALTER: modifies an existing database object, such as a table.

ALTER TABLE Employees
ADD middle_name varchar(255);

  • DROP: deletes an entire table, a view of a table, or other objects in the database.

DROP TABLE Employees;

SELECT: retrieves certain records from one or more tables

SELECT title, author, pub_date
FROM catalog
WHERE pub_date = 2021;

  • INSERT: creates a record.

INSERT INTO Employees (last_name, first_name)
VALUES (‘Alan’, ‘Smithee’);

  • UPDATE: modifies records.

UPDATE Employees
SET last_name = ‘Smith’, first_name = ‘Robert’
WHERE employee_ID = 1;

  • DELETE: deletes records.

DELETE FROM Employees
WHERE last_name = ‘Smithee’;

  • GRANT: gives a privilege to the user.

GRANT SELECT, INSERT, UPDATE, DELETE ON Employees TO user1;

  • REVOKE: takes back privileges granted by the user.

REVOKE SELECT, INSERT, UPDATE, DELETE ON Employees FROM user1;

SQL is a powerful language and is relatively easy to learn. It is the standard language for using relational databases and is used by developers and database administrators to manage and retrieve data stored in databases.

Related posts:

About Author


Discover more from SURFCLOUD TECHNOLOGY

Subscribe to get the latest posts sent to your email.

Leave a Reply

Your email address will not be published. Required fields are marked *

Discover more from SURFCLOUD TECHNOLOGY

Subscribe now to keep reading and get access to the full archive.

Continue reading