SQL DDL - DDL: Data Definition Language Murach Chapters 10...

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

View Full Document Right Arrow Icon
DDL: Data Definition Language Murach Chapters 10 and 11
Background image of page 1

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

View Full DocumentRight Arrow Icon
SQL: Structured Query Language DDL CREATE ALTER DROP DCL GRANT REVOKE DENY DML SELECT INSERT UPDATE DELETE
Background image of page 2
DDL: Data Definition Language CREATE TABLE CREATE INDEX ALTER TABLE DROP TABLE DROP INDEX There are many other variations of the CREATE, ALTER and DROP commands
Background image of page 3

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

View Full DocumentRight Arrow Icon
Create Table Syntax CREATE TABLE table_name ( column_name_1 column_name_2 column_name_N table_attributes ) data_type data_type data_type attributes , attributes , . .. attributes , Note: SQL is case insensitive and “spacing” insensitive
Background image of page 4
Create Table Syntax CREATE TABLE table_name ( column_name No reserved words Avoid special symbols [First Name] data_type attributes ,
Background image of page 5

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

View Full DocumentRight Arrow Icon
Create Table Syntax CREATE TABLE table_name ( column_name data_type Char(X) NChar(X) Varchar(X) NVarchar(X) Int Decimal(X,Y) Money Datetime (and many other data types) attributes ,
Background image of page 6
Create Table Syntax CREATE TABLE table_name ( column_name data_type attributes , Null or Not Null Default Values Primary Key References (i.e., Foreign Key) Check Constraint (i.e., Validation Rule)
Background image of page 7

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

View Full DocumentRight Arrow Icon
Sample Database Note 1: Parents before children Note 2: These tables are slightly different from before
Background image of page 8
Employee Table CREATE TABLE tblEmployee ( FirstName Varchar(20) Not Null , MiddleName Varchar(20) Null , LastName Varchar(30) Not Null What is the difference between Char(20) and Varchar(20)? What is the difference between Varchar(20) and Varchar(MAX)?
Background image of page 9

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

View Full DocumentRight Arrow Icon
Employee Table - Simple PK CREATE TABLE tblEmployee ( FirstName Varchar(20) Not Null , MiddleName Varchar(20) Null , LastName Varchar(30) Not Null , EmployeeID Varchar(10) Primary Key By default, primary keys are clustered. Primary keys cannot be null. Primary keys must be unique.
Background image of page 10
Employee Table - Simple PK CREATE TABLE tblEmployee ( FirstName Varchar(20) Not Null , MiddleName Varchar(20) Null , LastName Varchar(30) Not Null , EmployeeID Int Primary Key By default, primary keys are clustered.
Background image of page 11

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

View Full DocumentRight Arrow Icon
Employee Table - Simple PK CREATE TABLE tblEmployee (
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/26/2011 for the course MIS 325 taught by Professor Mote during the Spring '08 term at University of Texas.

Page1 / 42

SQL DDL - DDL: Data Definition Language Murach Chapters 10...

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

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