SQL - Part II: Yong Choi School of Business CSU, Bakersfield
SQL - Part II: Yong Choi School of Business CSU, Bakersfield
Yong Choi
School of Business
CSU, Bakersfield
SQL Examples – Aggregate Functions
• The union of two tables is a table containing all rows that are in
either the first table, the second table, or both tables.
– Two tables involved in union must have same structure.
UPDATE Project
SET PrjtLocat = 'Bellaire', DeptNum = 5
WHERE PrjtNum = 10;
UPDATE Employee
SET Salary = Salary * 1.1
WHERE Branch = 'Lincoln';
SQL - Data Manipulation (con’t)
UPDATE Customer
SET Street = '1445 Rivard'
WHERE CustomerNum='524';
SQL Examples - Data Manipulation
DELETE *
FROM OrderLine
WHERE PartNum='BV06';
SQL Examples – Creating a New Table
Using a Existing Table
• Example 31: save as example 31
– Create a new table named SmallCust, consisting
of all fields from the Customer table and those
rows in which the credit limit is less than or equal
to $7,500.
SELECT
INTO Name of table to create
FROM
WHERE
Example 31
SQL Query to Create New Table
Example 31
Example:
CREATE SCHEMA AUTHORIZATION JONES;
SQL - Data Definition II
Using Access
Create table CSUB
(EmpID Number, LastName Char(20), FirstName Char(20), Street
Char(30), City Char(20), State Char(2), Phone Number);