Fall08_SQL

Fall08_SQL - SQL (SECTION 3.2, 3.3, 3.4, 3.5, 3.7) Note:...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Sunday, September 1 SQL (SECTION 3.2, 3.3, 3.4, 3.5, 3.7) Note: Parts of this lecture were developed by Professor Zartoshty
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sunday, September 2 History IBM Sequel language developed as part of System R project at the IBM San Jose Research Laboratory Renamed Structured Query Language (SQL) ANSI and ISO standard SQL: SQL-86 SQL-89 SQL-92 SQL:1999 (language name became Y2K compliant!) SQL:2003 Commercial systems offer most, if not all, SQL-92 features, plus varying feature sets from later standards and special proprietary features. Not all examples here may work on your particular system.
Background image of page 2
Sunday, September 3 Data Definition Language The schema for each relation. The domain of values associated with each attribute. Integrity constraints The set of indices to be maintained for each relations. Security and authorization information for each relation. The physical storage structure of each relation on disk. Allows the specification of not only a set of relations but also information about each relation, including:
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sunday, September 4 Domain Types in SQL char(n). Fixed length character string, with user-specified length n. varchar(n). Variable length character strings, with user-specified maximum length n. int. Integer (a finite subset of the integers that is machine-dependent). smallint. Small integer (a machine-dependent subset of the integer domain type). numeric(p,d). Fixed point number, with user-specified precision of p digits, with n digits to the right of decimal point. real, double precision. Floating point and double-precision floating point numbers, with machine-dependent precision. float(n). Floating point number, with user-specified precision of at least n digits.
Background image of page 4
Sunday, September 5 SQL INTRODUCTION For the purposes of the following, assume the existence of these two relations: Emp (SS#, name, age, salary, dno) Dept (dno, dname, floor, mgrSS#) Structured Query Language ( SQL ) consists of four basic commands: Select, Insert, Update, and Delete. SQL provides commands to change the state of database: table creation/deletion, insert , delete , and update
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sunday, September 6 Create Table Construct An SQL relation is defined using the create table command: create table r ( A 1 D 1 , A 2 D 2 , . .., A n D n , (integrity-constraint 1 ), ..., (integrity-constraint k )) r is the name of the relation each A i is an attribute name in the schema of relation r D i is the data type of values in the domain of attribute A i Example: create table branch ( branch_name char(15) not null, branch_city char(30), assets integer)
Background image of page 6
Sunday, September 7 Integrity Constraints in Create Table not null primary key ( A 1 , . .., A n ) Example: Declare branch_name as the primary key for branch and ensure that the values of assets are non-negative. create table
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 45

Fall08_SQL - SQL (SECTION 3.2, 3.3, 3.4, 3.5, 3.7) Note:...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online