Lab_03_demo - IST210 Organization of Data In Class...

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

View Full Document Right Arrow Icon
IST210 Organization of Data In Class Demonstration of SQL CREATE, ALTER TABLE, DROP TABLE This is NOT the lab assignment but an example of the techniques for the lab. Information to Create Tables FOR DEMONSTRATION ONLY
Background image of page 1

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

View Full DocumentRight Arrow Icon
Table Title Field Name Data Type Field Size Primary key Foreign Key employee Employee_id Numeric 4 Yes Last_name Varchar 15 First_name Varchar 15 Middle_init Varchar 1 Job_id Numeric 3 Reference: job_id of JOB Hire_date Date
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Instructions on SQL statements: Create Tables using SQL/Plus: SQL> CREATE TABLE tablename ( Fieldname1 Varchar(10) not null, Fieldname2 Numeric(6), Fieldname3 Numeric(6,2), Fieldname4 date ); Alter tables: Adding a single field as a Primary Key ALTER TABLE tablename ADD CONSTRAINT pk_name PRIMARY KEY (column_name); Adding multiple fields as a composite Key ALTER TABLE tablename ADD CONSTRAINT pk_name PRIMARY KEY (column_name1, column_name2); Adding a Foreign Key ALTER TABLE tablename ADD CONSTRAINT fk_name FOREIGN KEY (column_name) REFERENCES tablename (column_name);
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/02/2009 for the course IST 210 taught by Professor Mcconn,charlotteryoo,jungwoo during the Summer '08 term at Pennsylvania State University, University Park.

Page1 / 7

Lab_03_demo - IST210 Organization of Data In Class...

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

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