Introduction to Basics of SQL ….. !!!!
By: Aditya Jagtap
Tags: MySQL, Oracle, Sql, Sqlite, Sql Queries

Hello everyone. I hope you all are doing great & staying safe in this situation of the pandemic. Today I’ve came with a great topic i.e, SQL, which is also known as Structured Query Language.

So today we will cover the points :

1. What is SQL ?

2. What we can do by using SQL ?

3. Syntax of the SQL queries.

4. Basic & important queries of SQL.

5. Next track in SQL.

Let’s get started with our Topic of SQL.

What is SQL ?

SQL stands for, “Structured Query Language”.

Using the SQL one can manipulate and retrieving data stored in the databases at his own will.

SQL became a standard language for manipulating databases & it have the standard of the American National Standards Institute (ANSI) in 1986 & of the International Organization for Standardization (ISO) in 1987.

SQL is a domain-specific language used in programming.

SQL is designed for managing data held in a relational database management system, or for stream processing in a relational data stream management system.

What we can do by SQL ?

By using the SQL, one can the execute simple & nested queries against a database.

By using the SQL, one can retrieve data from a database.

By using the SQL, one can insert, update & delete the records in a database.

By using the SQL, one can create new databases, new tables in a database, stored procedures in a database, views in a database & many more .

By using the SQL one can set permissions on tables, procedures, and views.

By using the SQL, one can perform the simple queries like SELECT, UPDATE, DELETE, INSERT, WHERE, etc. on the databases.

Syntax of the SQL queries

Syntax of the SQL queries are a bit simple. It is just spelled as an English language.

language. Format to write a query is as shown below:

SELECT * FROM table_name;

Suppose we have a database of the “Customers” table. In that table mainly contains five records (one for each customer) and seven columns (Customer_ID, Customer_Name, Contact_Name, Address, City, Postal_Code, and Country).

Then we can write a query to fetch all the columns from the table as :

SELECT * FROM Customers;

By executing this query we will fetch all the data from that table. So now we will see some basic queries that we can execute on the database.

Basic queries of SQL & their syntax

There are some basic but important SQL queries like SELECT, UPDATE, DELETE, INSERT, DROP & ALTER. Their respective syntax are as shown below :

SELECT Statement : Used to extract the data from a database.

Syntax : SELECT * FROM table_name;

: Used to the data from a database. : SELECT * FROM table_name; UPDATE Statement : Used to update the data in a database.

Syntax : UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;

: Used to the data in a database. : UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition; DELETE Statement : Used to delete the data from a database.

Syntax : DELETE FROM table_name WHERE condition;

: Used to the data from a database. : DELETE FROM table_name WHERE condition; INSERT INTO Statement : Used to insert the new data into a database.

Syntax : INSERT INTO table_name (column1, column2, column3, …)

VALUES (value1, value2, value3, …);

Used to the new data into a database. : INSERT INTO table_name (column1, column2, column3, …) VALUES (value1, value2, value3, …); CREATE DATABASE Statement : Used to create a new database.

Syntax : CREATE DATABASE databasename;

Used to a new database. : CREATE DATABASE databasename; CREATE TABLE Statement : Used to create a new table in the database.

Syntax : CREATE TABLE table_name (

column1 datatype,

column2 datatype,

column3 datatype,

….

);

Used to create a new table in the database. : CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 datatype, …. ); ALTER TABLE Statement : Used to do modifications in a table of a database.

Syntax : ALTER TABLE table_name

ADD column_name datatype;

Used to do modifications in a table of a database. : ALTER TABLE table_name ADD column_name datatype; DROP TABLE Statement : Used to delete a table from a database.

Syntax : DROP TABLE table_name;

Used to delete a table from a database. : DROP TABLE table_name; CREATE INDEX Statement : Used to create an index (search key) of a database.

Syntax : CREATE INDEX index_name

ON table_name (column1, column2, …);

: Used to create an index (search key) of a database. : CREATE INDEX index_name ON table_name (column1, column2, …); DROP INDEX Statement : Used to delete an index of a database.

Syntax : DROP INDEX index_name;

Next track in SQL

Today we have seen some important aspects of the SQL & known more about the SQL like what is SQL, Why we need the SQL, it’s syntax & some basic queries of the SQL. But SQL has very large conceptual base that can’t be covered in a one blog that we all know. So until that keep revising these basic but most important concepts of SQL.

Stay tuned for the next post.

Thank You.