Download presentation
Presentation is loading. Please wait.
Published byJoan Banks Modified over 8 years ago
1
Advanced Accounting Information Systems Day 12 Understanding the SQL Language September 21, 2009
2
Announcements –Meet the Firm – tomorrow from 3:00 to 6:00 p.m. Memorial Union –Career Fair – Wednesday –Assignment 2 due today
3
Objectives Basic SQL features and functionality SELECT statement fundamentals Operators and functions DDL and DML statements
4
Questions for today What is the difference between comparison and logical operators?
5
Questions for today Identify and describe the use of the three basic DML commands
6
SELECT fundamentals DBMS analyzes the declarative SQL SELECT statement and creates an access path – plan for what steps to take to respond to the query Examples of select when ordering t- shirts from Lands’ End website
7
SELECT fundamentals SELECT FROM WHERE ;
8
Using SELECT to evaluate expressions Select 5 + 7 total_value; Select 5 + 7 as total_value;
9
Understanding Operators and Functions Unary operators Binary operators
10
Understanding Arithmetic Operators Arithmetic operators –+ –- –* –/ –% Concatenate numbers –Select ‘5’ + ‘5’ as total_value
11
Comparison and Logical Operators Comparison operators –= ? > >= ! Logical operators –AND BETWEEN LIKE NOT OR LIKE Wildcard characters –% _ Subquery –Special way of retrieving information where one query is dependent on another query
12
General Function Categories Numeric Mathematical Date/Time Aggregate String Conversion
13
Aggregate Functions AVG COUNT COUNT_BIG MAX MIN SUM Use of GROUP BY Statement
14
DML INSERT into TABLENAME VALUES Insert into INVOICE (INVNO, INVDATE, AMOUNT) VALUES (324, 5/25/09, 13.30)
15
DML UPDATE TABLE SET COLUMN-NAME = UPDATE INVOICE SET AMOUNT = 13.50 WHERE INVNO = 325;
16
DML DELETE FROM TABLENAME WHERE SEARCH-CONDITION DELETE FROM INVOICE WHERE INVNO = 800
17
DQL SELECT LIST ATTRIBUTES FROM TABLE WHERE QUALIFYING CONDITIONS GROUP BY ORDER BY WHAT IS THE OTHER NAME FOR QUALIFYING CONDITIONS? USE * TO retrieve entire record in one table Retrieving other values –Expression –Function
18
DDL Create Alter Drop
19
Practice List all employees with test scores > 40 from departments A or B Find the total test scores for Departments A and C Find the total and average test scores for employees in Departments A and C Change department of Baker from A to C Insert yourself as an employee
20
Questions for Wednesday Distinguish between ORDER BY and GROUP BY Using Employee database for Marcia Felix Corporation –Assume employeenumber 7799 changes departments to Department D, update his employee record –Assume employee 4091 leaves the company, delete his record
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.