SQL is a Structured Query Language used for interacting with a RDBMS.

* RDBMS (Relational Database Management Systems) - helps users create & maintain a relational database.

It is actually a hybrid language. It’s basically 4 types of languages in one.

  • Data Query Language (DQL) : Used to query the database for information. Can get information that’s already stored in the database.
  • Data Definition Language (DDL) : Used for defining database schemas.
  • Data Control Language (DCL) : Used for controlling access to data in the database. Handles user & permissions management.
  • Data Manipulation Language (DML) : Used for inserting, updating, and deleting data from the database.

In short, we can do the following things with SQL:

  • Create, Read, Update, and Delete data
  • Create & Manage databases
  • Design & Create database tables
  • Perform administrative tasks (security, user management, import/export, etc)

A Query is a set of instructions given to the RDMBS (written in SQL) that tell the RDMBS what information a developer wants it to retrieve for the developer.

Example »

View the table:

Table operations:

  • Delete a table: DROP TABLE student;
  • Add a table: ALTER TABLE student ADD gpa DECIMAL(3,2);
  • Delete a column: ALTER TABLE student DROP gpa;
  • Delete a row: DELETE FROM student WHERE student_id = 1

Insert data:

View all data:

SELECT * FROM student;

What if we don’t know a student’s major?

INSERT INTO student(student_id, name) VALUES(4, 'Kyle');

View the table:

Delete multiple rows:

DELETE FROM student WHERE student_id IN (4,5,6,7,8);

Change values that match a condition:

Basic queries:

Thanks for attention!