MindMapofStructuredQueryLanguageSQL
MindMapofStructuredQueryLanguageSQL
net/publication/383211934
CITATIONS READS
0 74
1 author:
Ala'a M. Al-Momani
Universiti Sains Malaysia
100 PUBLICATIONS 94 CITATIONS
SEE PROFILE
All content following this page was uploaded by Ala'a M. Al-Momani on 18 August 2024.
SELECT: This keyword initiates a query and tells the database that you're
going to specify which columns you want to retrieve. In this case, using *,
which is a wildcard character that means "all columns.
FROM: This keyword specifies which table to pull data from. Here, it's telling
the SQL engine to look in the table named Customers.
Customers: This is the name of the table from which the data will be
retrieved.
SQL Statement
Retrieve Specific Where 3
Columns
1 2 Clause
SELECT * FROM Products here Price > 30 AND SupplierID = 11 SELECT * FROM Products Where Price <25;
Order by Price;
"ORDER BY"
Clause
Less
8 4 than
"ORDER BY"
6 5
Greater
7 Clause “AND”
than
Operator
SELECT * FROM Products here Price > 30 AND SupplierID = 11 SELECT * FROM Products Where Price >25 AND SupplierID = 3; SELECT * FROM Products Where Price >25;
Order by Price DESC;
SELECT * FROM Products SELECT * FROM Products SELECT * FROM Products
WHERE ProductName = 'Chang' OR 'Chais'; WHERE ProductName IN ('Chais','Chang','Konbu'); WHERE Price BETWEEN 20 AND 30;
“OR” “IN”
“BETWEEN”
3
1 Operator Operator
2 Operator
SELECT Country, Count(*) as "No of records" FROM Customers SELECT Count(*) FROM Customers;
Group By Country Order by 2;
ALIAS
Record
8 4
"ORDER BY" 6 5
&
7 "Group By"
"Group By"
Clause “MAX”
SELECT Country, Count(*) FROM Customers SELECT Country, Count(*) FROM Customers SELECT MAX(Price) FROM Products;
Group By Country Order by 2; Group By Country;
https://www.mysql.com/downloads/
Download Download 3
1 SQL
Download
SQL 2 SQL
Text
Area
8 4
Information 6 5
about Tables
7 Tables Schemas
SQL Commands SQL Commands
2- DDL (Data Definition Language)
1- DQL (Data Query Language)
❑ Purpose: Used to define and modify the structure of database objects like tables,
❑ Purpose: Used to query the database and retrieve data.
schemas, indexes, and database links.
❑ Key Command: ❑ Key Command:
✓ CREATE: To create new database objects.
SELECT: This is the primary command used in DQL to query data from the
✓ ALTER: To modify existing database objects.
database. It can be combined with various clauses like WHERE, GROUP BY, ✓ DROP: To delete database objects.
✓ TRUNCATE: To remove all records from a table, including all spaces allocated
HAVING, and ORDER BY to filter, group, and order the data accordingly.
for the records are removed.
❑ Purpose: Used to insert, update, delete, and manipulate data in the database.
❑ Key Command:
“LIMIT”
8 4 ❖ INSERT: To add new rows to a table.
UPPER
8 4
6 5
RAND
7 ABS
LENGTH 3
1 LOWER
2
TRIM
8 4
6 5
RTRIM
7 LTRIM
PLACE 3
1 LOCATE
2
8 4
6
CREATE A
7 TABLE 5
USE
DROP 3
1 MODIFY
2
PRIMARY
KEY
8 4
6 5
DELETE
7 UPDATE
1 FOREIGN JOIN 3
KEY 2
SUB-
QUERY
8 4
6 5
SUB-QUERY
7 FULL OUTER
JOIN