SQL-Review of class XI - part 2
SQL-Review of class XI - part 2
What is SQL?
1
10/5/2024
Features of SQL
SQL has the following salient features and strong processing capabilities:
• It can retrieve data from a database through Query processing.
• It can insert records into a database.
• It can update records in a database.
• It can create new databases and modify the existing ones.
• It can create new tables in a database.
• It can create views in a database.
• It can allow modifying security settings for the system
Advantages of SQL
1. Ease of use: It is very easy to learn and use and does not require high-end
professional training to work upon it.
2. Large volume of data can be handled quite easily.
3. No coding required: It is non-procedural and a unified language, i.e., we need not
specify the procedures to accomplish a task but only need to give a command to
perform the activity.
4. SQL can be linked to most of the other high-level languages which makes it the first
choice for database programmers.
5. Portable: It is compatible with other database programs like Dbase IV, FoxPro, MS
Access,Db2, MS SQL Server, Oracle, Sybase, etc.
2
10/5/2024
Advantages of SQL
6. SQL is not a case-sensitive language, i.e., both capital and small letters are recognized and
treated equally by it.
7. Powerful language: All SQL operations are performed at a prescribed and fixed level, i.e., one
SELECT command can retrieve data from multiple rows and one UPDATE command can edit
multiple rows at a time. These features make SQL a very powerful language as compared to
other languages where one command can process a single record at a time.
8. Reliable: SQL provides a well-defined set of commands that gives desirable results without
any ambiguity.
9. Freedom of data abstraction: SQL provides a greater degree of freedom of abstraction
compared to any other procedural language.
10. Complete language for a database: Apart from being a strong query-processing
language, it can also be used to create, insert, delete and control access to data in
databases
SQL Commands
3
10/5/2024
• DDL statements allows us to perform tasks related to data definition, i.e., related to the
structure of database objects.
• They are used to create, modify, and drop database objects, such as tables.
• Examples of DDL commands are:
• CREATE DATABASE
• USE DATABASE
• CREATE TABLE
• DESC
• ALTER TABLE
• DROP TABLE
• DML statements are used to manipulate data i.e. records or rows in a table or relation.
• It allows us to insert, update and delete data from tables.
• Examples of DML Statements are:
• INSERT INTO
• UPDATE
• DELETE
4
10/5/2024
5
10/5/2024
What is MySQL?
Advantages of MySQL
6
10/5/2024
7
10/5/2024
8
10/5/2024
9
10/5/2024
10
10/5/2024
11
10/5/2024
12
10/5/2024
13
10/5/2024
14
10/5/2024
15
10/5/2024
16
10/5/2024
17
10/5/2024
18
10/5/2024
19
10/5/2024
20
10/5/2024
21
10/5/2024
22
10/5/2024
23
10/5/2024
24
10/5/2024
If you want to sort or order the records of a table , you can use the
ORDER BY clause of SQL, SELECT statement as per following format:
Syntax:-
SELECT <column names> FROM <table>
[WHERE <condition>]
ORDER BY <column name 1 > [ASC/DESC] [, <column name2>
[ASC/DESC], ...];
Keywords ASC and DESC denote the order - ASC stands for ascending
and DESC stands for descending.
25
10/5/2024
For example:
OR
For example:
26
10/5/2024
For example:
The following statement will sort the records firstly on the column name
and then on the basis of descending order of column marks.
27
10/5/2024
28
10/5/2024
29
10/5/2024
30
10/5/2024
31
10/5/2024
32