Introduction to SQL
Introduction to SQL
Fundamentals
Prof. Anil Kumar
Basic Terminologies
Terminologies
What is a table?
• The data in an RDBMS is stored in database objects which are called as tables.
• This table is basically a collection of related data entries and it consists of
numerous columns and rows.
• A table is the most common and simplest form of data storage in a relational
database.
• The following program is an example of a CUSTOMERS table −
| ID | NAME | AGE | ADDRESS | SALARY |
+----+----------+-----+-----------+----------+----------------------------------------
| 1 | Ramesh | 32 | Ahmedabad | 2000.00 |
| 2 | Khilan | 25 | Delhi | 1500.00 |
| 3 | kaushik | 23 | Kota | 2000.00 |
| 4 | Chaitali | 25 | Mumbai | 6500.00 |
| 5 | Hardik | 27 | Bhopal | 8500.00 |
| 6 | Komal | 22 | MP | 4500.00 |
| 7 | Muffy | 24 | Indore | 10000.00 |
+----+----------+-----+-----------+----------+----------------------------------------
Terminologies
What is a field?
• Every table is broken up into smaller entities called fields. The fields in the
CUSTOMERS table consist of ID, NAME, AGE, ADDRESS and SALARY.
• A field is a column in a table that is designed to maintain specific information
about every record in the table.
What is a Record or a Row?
• A record is also called as a row of data is each individual entry that exists in a
table. For example, there are 7 records in the above CUSTOMERS table.
• A record is a horizontal entity in a table. Following is a single row of data or record
in the CUSTOMERS table −
+----+----------+-----+-----------+----------+----------------------------------
| 1 | Ramesh | 32 | Ahmedabad | 2000.00 |
+----+----------+-----+-----------+----------+----------------------------------
Terminologies
What is a column?
• A column is a vertical entity in a table that contains all information associated with
a specific field in a table.
• For example, a column in the CUSTOMERS table is ADDRESS, which represents
location description and would be as shown below −
+-----------+-------------
| ADDRESS |
+-----------+-------------
| Ahmedabad |
| Delhi |
| Kota |
| Mumbai |
| Bhopal |
| MP |
| Indore |
+----+------+-------------
Introduction to SQL
What is SQL
• SQL stands for Structured Query Language
• SQL is Structured Query Language, which is a computer language
for storing, manipulating and retrieving data stored in a relational
database.
• SQL is the standard language for Relational Database System.
All the Relational Database Management Systems (RDMS) like
MySQL, MS Access, Oracle, Sybase, Informix, Postgres and SQL
Server use SQL as their standard database language.
• Also, they are using different dialects, such as −
– MS SQL Server using T-SQL,
– Oracle using PL/SQL,
– MS Access version of SQL is called JET SQL (native format) etc.
Why SQL
SQL Commands
• The standard SQL commands to interact with
relational databases are CREATE, SELECT,
INSERT, UPDATE, DELETE and DROP. These
commands can be classified into the following
groups based on their nature −
– DDL - Data Definition Language
– DML – Data Manipulation Language
– DCL – Data Control Language
About SQL
CREATE
Creates a new table, a view of a table, or other object in the database.
ALTER
Modifies an existing database object, such as a table.
DROP
Deletes an entire table, a view of a table or other objects in the
database.
About SQL