SQL SYNTAX


SQL Syntax | SQL Tutorial | Minigranth

SQL Syntax

  • As SQL is a type of language itself, hence like any other language used in Computer Science and Information Technology, it has its own unique syntax too.
  • An SQL syntax is nothing but the structure of queries through which manipulation on the database can be done. It is basically the “Structure of Statements” used while generating the queries.
  • The simplest of examples representing the syntax of an SQL query can be :

The image describes the SQL Syntax. It consists of two basic select queries.
SQL Syntax

  • The queries mentioned above is used for “Selecting all the data/tables form the database/tables”.
  • Let’s look at some more queries :
    • Select * from employee_details.
    • Insert into student(roll_no, name) values(1, Ram) ;
    • Drop table student_details; and many more.

SQL Syntax : Points To Ponder

  • All SQL commands ends with a semicolon.
  • All SQL commands starts with a keyword.
  • SQL commands are case insensitive.
  • While writing queries, table name and database name must match with original database and tables created.

SQl Syntax : Keywords

  • There exists a number of keywords such as Select, Insert, Drop etc. all of which have specific functionalities in SQL. These keywords are solely responsible for manipulating data in/from the database.
  • The keywords are listed below along with “What they are used for”.
    • Create Database : Used for creating a database.
    • Create Table : Used for creating a table.
    • Select : Select/Extract/Fetch data from database/table.
    • Update : Used to update data in the database/table.
    • Delete : Used to delete data form the database/table.
    • Alter Table : Used to modify the attribute/values of table.
    • Drop Table : Deletes table from database.
  • We will cover all these keywords one by one with the help of queries and try to make you understand their uses with examples and how we can create queries from these keywords.