DEV Community

Cover image for Structure Query Language
Muhammad Rameez
Muhammad Rameez

Posted on • Edited on

Structure Query Language

What is SQL ?

SQL (Structured Query Language) is a programming language used to communicate with databases. It is used to store, retrieve, manipulate, and manage data in relational databases. SQL uses statements to perform tasks such as updating data in a database or retrieving data from a database. We can delete, alter and fetch the data by using query of SQL within a second. SQL is not a Case sensitive language which means you can write query in all caps or in all small, it will works. SQL can create stored procedures and views in a database.

For Example :
Select * from life where memory like 'Joy'
Select * from Bytewise where fellow like 'Data Engineer'

There are 3 types of SQL :

  • DDL
  • DML
  • DQL

What is DDL ?

DDL (Data Definition Language) is a type of SQL language used to define the structure of a database. It is used to create, modify, and delete database objects such as tables, views, and other database structures. DDL statements are also used to set permissions on database objects and to create and alter stored procedures and functions.

What is DML ?

DML (Data Manipulation Language) is a type of SQL language used to manipulate data. It is used to insert, update, delete, and select data in a database. DML statements are also used to control access to the data stored in a database.

What is DQL ?

DQL (Data Query Language) is a type of SQL language used to query data from a database. It is used to retrieve data from one or more tables, views, or other sources in a database. DQL statements are also used to specify conditions in the query, such as selecting data based on certain criteria.

Famous SQL Commands :

  • Create Database :
    CREATE DATABASE <database_name>;

  • Alter a Database :
    ALTER DATABASE <database_name> [MODIFY]<newName_database>;

  • Deleting a Database :
    DROP DATABASE <database_name>;
    TRUNCATE DATABASE <database_name>;
    DELETE DATABASE <database_name>;

Data Types used in SQL :

Data Types in SQL are used to define the type of data stored in the columns of a database table. The most common SQL data types are:

INTEGER, VARCHAR, BOOLEAN, DATE, TIME, and DECIMAL.

Each data type has a specific set of properties and characteristics that define how it is stored and used.

For example, INTEGER is used to store whole numbers, VARCHAR is used to store variable-length strings, BOOLEAN is used to store true or false values, and DATE is used to store date and time values. Other data types, such as DECIMAL, can be used to store more complex data types such as currency values.

List of SQL Important Statements :
SQL all about these statements and keyword that all have different behavior and use. We can discuss it as we move forward:

  • Create Statements
  • Insert Statements
  • Select Statements
  • Update Statements
  • Delete Statements
  • Distinct
  • Like
  • Top
  • Aggregate functions (count(), add(), avg())
  • Min(), Max()
  • Between
  • Alias
  • Union, Intersect, Except
  • Order by
  • In
  • Where
  • is
  • Null
  • Joins
  • Group by
  • Having
  • Case

For studding all queries in SQL, Click here

For studding Joins in SQL, Click here

Top comments (0)