SQL (Structured Query Language) is a programming language used to manage relational databases. Here are some basic SQL commands:
SELECT - used to select data from a database
Example:
SELECT column1, column2 FROM table_name;
INSERT INTO - used to insert new data into a database
Example:
INSERT INTO table_name (column1, column2) VALUES (value1, value2);
UPDATE - used to update existing data in a database
Example:
UPDATE table_name SET column1 = value1, column2 = value2 WHERE some_column = some_value;
DELETE - used to delete data from a database
Example:
DELETE FROM table_name WHERE some_column = some_value;
CREATE DATABASE - used to create a new database
Example:
CREATE DATABASE database_name;
CREATE TABLE - used to create a new table in a database
Example:
CREATE TABLE table_name (column1 datatype, column2 datatype, column3 datatype);
ALTER TABLE - used to add, modify or delete columns in an existing table
Example:
ALTER TABLE table_name ADD column_name datatype;
DROP TABLE - used to delete a table from a database
Example:
DROP TABLE table_name;
Note: These are some of the basic SQL commands, but there are many more advanced commands that can be used to manage databases.
Top comments (0)