230 likes | 376 Views
Advanced Accounting Information Systems. Day 11 Understanding the SQL Language September 18, 2009. Announcements. Assignment 2 due Monday Business Week activities continue. Catch up on topics we skipped. Database structures Ways to organize individual records in a database Hierarchical
E N D
Advanced Accounting Information Systems Day 11 Understanding the SQL Language September 18, 2009
Announcements Assignment 2 due Monday Business Week activities continue
Catch up on topics we skipped Database structures Ways to organize individual records in a database Hierarchical Network Relational
Catch up on topics we skipped Data warehouse Identify similarities between data warehouse and a fine restaurant (p. 158-159)
Objectives – Chapter 6 – Understanding the SQL Language Basic SQL features and functions SELECT statement fundamentals Operators and functions DDL and DML statements
Questions for today Five basic features of SELECT
SQL Structure DDL DML and DQL
SQL Structure SQL developed in 1980s incorporates both DDL and DML standard per ANSI and ISO Included in many mainstream DBMS DB2 Oracle MySQL Informix Microsoft SQL Server
SQL Structure Basic features DDL DML Command operators Functions Transaction control
SQL Structure Two basic options for executing SQL commands Interactive (or dynamic) Embedded Query mode
Interactive SQL Character based interface (see Figure 6.1) Menu-driven interface (see Figure 6.2)
Embedded SQL Best suited to activities that must be performed periodically SQL commands are part of an executable program Can also be used in application programs
Command Basics Command syntax Command keywords (command clauses) Command parameters Results set (relational set) SELECT FROM WHERE
Error messages Command did not complete successfully Why do errors return give so little information?
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 SELECT FROM WHERE ;
Using SELECT to evaluate expressions Select 5 + 7 total_value
Understanding Operators and Functions Unary operators Binary operators Arithmetic operators Comparison and logical operators
DDL Create
DML INSERT into TABLENAME VALUES Insert into INVOICE (INVNO, INVDATE, AMOUNT) VALUES (324, 5/25/09, 13.30)
DML UPDATE TABLE SET COLUMN-NAME = UPDATE INVOICE SET AMOUNT = 13.50 WHERE INVNO = 325;
DML DELETE FROM TABLENAME WHERE SEARCH-CONDITION DELETE FROM INVOICE WHERE INVNO = 800
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
Questions for Monday What is the difference between comparison and logical operators? Identify and describe the use of the three basic DML commands