I have previously written about the top 5 skills that an IT Business Analyst should have and SQL is one of them.
SQL which is pronounced S-Q-L or sequel stands for Structured Query Language (SQL).
SQL is supported by all relational Database management Software (DBMS) which include Microsoft SQL server, MYSQL and Oracle. It is made up of commands that are used to create database and table structures, and perform various types of data manipulation and administration.
SQL commands which are also know as SQL queries are basically executable statements that are used to perform actions such as adding or deleting table rows or changing the features of a table.
The SQL statements that can be performed fall into two groups, which are :
- Data definition language (DDL) which are commands that are used to create database objects such as tables, indexes, views and define access rights.
- Data manipulation language (DML) which are commands that are used to insert, update, delete, and retrieve data within the database tables.
SQL is a nonprocedural language that is relatively easy to learn because a basic set of commands are inputted and it produces a result.
So what are some SQL commands ?
This is a list of some SQL commands and what they execute :
- SELECT : this statement is used to obtain data from a database which returns this data in the form of a result table that are called result-sets.
The syntax of the SQL SELECT statement is
SELECT column1, column2, columnN
Where column1, column2,…columnN are the names of the columns in the table into which you want to insert data.
- UPDATE : this statement is used to update the data in a database.
The syntax of the SQL UPDATE statement is
UPDATE table1, table2, …
SET column1 = expression1,
column2 = expression2,
WHERE table1.column = table2.column
- DELETE : this statement is used to delete the data in a database.
The syntax of the SQL DELETE statement is
DELETE FROM table_name WHERE condition;
- INSERT INTO : this statement is used to insert new rows of data into a database.
The syntax of the SQL INSERT INTO statement is :
INSERT INTO TABLE_NAME [(column1, column2, column3,…columnN)]
VALUES (value1, value2, value3,…valueN);
- CREATE TABLE : this statement is used to create a new table.
The syntax of the SQL CREATE TABLE statement is :
CREATE TABLE table_name (
Where the datatype identifies the type of data the column can hold (e.g. varchar, integer, date, etc.).
- ALTER TABLE : this statement is used to add, delete, or change columns in an existing table.
The syntax of the SQL ALTER TABLE statement is :
ALTER TABLE table_name
ADD column_name datatype;
- DROP TABLE : this statement is used to remove an existing table in a database.
The syntax of the SQL DROP TABLE statement is :
DROP TABLE table_name;
- CREATE DATABASE : this statement is used to create a new database.
The syntax of the SQL CREATE DATABASE statement is :
CREATE DATABASE TestDB;
- ALTER DATABASE : this statement is used to modify a database.
The Syntax for the ALTER DATABASE Statement is:
ALTER DATABASE database_name;
- CREATE INDEX : this statement is used to create a search key that are used to speed up data retrieval from the database.
The Syntax for the CREATE INDEX Statement is:
CREATE INDEX index_name
ON table_name (column1, column2, …);
- DROP INDEX : this statement is used to delete a previously created index.
The Syntax for the DROP INDEX Statement is:
DROP INDEX index_name ON table_name;