ch3 - Database System Concepts 5th Ed ©Silberschatz Korth...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: Database System Concepts, 5th Ed . ©Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-use Chapter 3: SQL Chapter 3: SQL ©Silberschatz, Korth and Sudarshan 3.2 Database System Concepts, 5 th Edition, Oct 5, 2006 Chapter 3: SQL Chapter 3: SQL ¡ Data Definition ¡ Basic Query Structure ¡ Set Operations ¡ Aggregate Functions ¡ Null Values ¡ Nested Subqueries ¡ Complex Queries ¡ Views ¡ Modification of the Database ¡ Joined Relations** ©Silberschatz, Korth and Sudarshan 3.3 Database System Concepts, 5 th Edition, Oct 5, 2006 History 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: z SQL-86 z SQL-89 z SQL-92 z SQL:1999 (language name became Y2K compliant!) z SQL:2003 ¡ Commercial systems offer most, if not all, SQL-92 features, plus varying feature sets from later standards and special proprietary features. z Not all examples here may work on your particular system. ©Silberschatz, Korth and Sudarshan 3.4 Database System Concepts, 5 th Edition, Oct 5, 2006 Data Definition Language 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: ©Silberschatz, Korth and Sudarshan 3.5 Database System Concepts, 5 th Edition, Oct 5, 2006 Domain Types in SQL 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. ¡ More are covered in Chapter 4. ©Silberschatz, Korth and Sudarshan 3.6 Database System Concepts, 5 th Edition, Oct 5, 2006 Create Table Construct 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 )) z r is the name of the relation z each A i is an attribute name in the schema of relation r z 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) ©Silberschatz, Korth and Sudarshan...
View Full Document

This note was uploaded on 10/24/2009 for the course CS 541 taught by Professor Clifton,b during the Fall '08 term at Purdue.

Page1 / 66

ch3 - Database System Concepts 5th Ed ©Silberschatz Korth...

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

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