Download presentation
1
Concepts of Database Management, 4th Edition, Pratt & Adamski
Chapter 3 The Relational Model 2: SQL Concepts of Database Management, 4th Edition, Pratt & Adamski
2
Concepts of Database Management, 4th Edition, Pratt & Adamski
Objectives Use simple and compound conditions in SQL Use computed fields in SQL Use built-in SQL functions Use subqueries in SQL Group records in SQL Concepts of Database Management, 4th Edition, Pratt & Adamski
3
Concepts of Database Management, 4th Edition, Pratt & Adamski
Objectives Join tables using SQL Perform union operations in SQL Use SQL to update database data Use an SQL query to create a table in a database Concepts of Database Management, 4th Edition, Pratt & Adamski
4
Concepts of Database Management, 4th Edition, Pratt & Adamski
Table Creation SQL CREATE TABLE Used to describe layout of a table Typical restrictions placed by DBMS Names cannot exceed 18 characters Names must start with a letter Names can contain only letters, numbers, and underscores (_) Names cannot contain spaces Concepts of Database Management, 4th Edition, Pratt & Adamski
5
Concepts of Database Management, 4th Edition, Pratt & Adamski
Typical Data Types INTEGER Numbers without a decimal point SMALLINT Uses less space than INTEGER DECIMAL(p,q) P number of digits; q number of decimal places CHAR(n) Character string n places long DATE Dates in DD-MON-YYYY or MM/DD/YYYY Concepts of Database Management, 4th Edition, Pratt & Adamski
6
Simple Retrieval Figures 3.1 - 3.2
Concepts of Database Management, 4th Edition, Pratt & Adamski
7
SQL Query to List Part Table
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
8
SQL Query with Where Condition
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
9
SQL Comparison Operators
Figure 3.7 Concepts of Database Management, 4th Edition, Pratt & Adamski
10
SQL Query to Find Customer 148
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
11
All Customers in ‘Grove’
SQL Query to Find All Customers in ‘Grove’ Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
12
Query to find Customers with Credit Limit Exceeding Balance
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
13
SQL Query with Compound Condition using ‘AND’
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
14
Concepts of Database Management, 4th Edition, Pratt & Adamski
SQL Query using ‘OR’ Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
15
Concepts of Database Management, 4th Edition, Pratt & Adamski
SQL Query using ‘NOT’ Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
16
Query with ‘BETWEEN’ Operator
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
17
SQL Query with Computed Field
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
18
SQL Query with Computed
Field and Condition Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
19
SQL Query with ‘LIKE’ Operator
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
20
SQL Query with ‘IN’ Operator
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
21
Concepts of Database Management, 4th Edition, Pratt & Adamski
SQL Query to Sort Data Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
22
SQL Query to Sort on Multiple Fields
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
23
SQL Query to Count Records
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
24
SQL Query to Count Records and Calculate a Total
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
25
SQL Query to Perform Calculations and Rename Fields
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
26
SQL Query with Subquery
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
27
SQL Query to Group Records
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
28
SQL Query to Restrict Groups Figures 3.44 - 3.45
Concepts of Database Management, 4th Edition, Pratt & Adamski
29
Concepts of Database Management, 4th Edition, Pratt & Adamski
SQL Query with ‘WHERE’ and ‘HAVING’ Clauses Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
30
SQL Query to Join Tables
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
31
Query to Restrict Records in Join
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
32
Query to Join Multiple Tables
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
33
SQL Query to Perform Union
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
34
SQL Query to Update Data
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
35
SQL Query to Delete Rows
Figure 3.58 Concepts of Database Management, 4th Edition, Pratt & Adamski
36
SQL Query to Create New Table
Figures Concepts of Database Management, 4th Edition, Pratt & Adamski
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.