sql9 - (1 11:45 AM SQL Handout Douglas Shook(2 11:45 AM...

Info icon This preview shows pages 1–4. Sign up to view the full content.

SQL Handout Douglas Shook 03/01/05 (1) 5/13/2009 6:22 a5/p5
Image of page 1

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

TABLE OF CONTENTS 1. REQUISITE FEATURES OF A COMPREHENSIVE RELATIONAL LANGUAGE ................................................. 3 2. DATA DEFINITION LANGUAGE (DDL) - BASIC DDL STATEMENTS ................................................................. 3 3. DATA DEFINITION LANGUAGE (DDL) - BASIC TABLE DEFINITIONS .............................................................. 3 4. DATA DEFINITION LANGUAGE (DDL) - CURRENT DATA TYPES ....................................................................... 4 5. DATA DEFINITION LANGUAGE (DDL) - COLUMN CONSTRAINTS ............................................................. 4 6. DATA DEFINITION LANGUAGE (DDL) - TABLE CONSTRAINTS ................................................................ 5 7. DATA DEFINITION LANGUAGE (DDL) - ADDING COLS AND CONSTRAINTS .............................................. 6 8. DATA DEFINITION LANGUAGE (DDL) – CUSTOMER ORDER ERD FOR TABLES .............................................. 7 9. DATA DEFINITION LANGUAGE (DDL) - TABLES WITH CONSTRAINTS .......................................................... 8 10. DATA DEFINITION LANGUAGE (DDL) - Enforcing Cardinality and Business Rules .............................................. 9 12. DATA MANIPULATION LANGUAGE (DML) - QUERY FORMAT ........................................................... 12 13. DATA MANIPULATION LANGUAGE (DML) - SINGLE TABLE QUERIES ..................................................... 14 14. DATA MANIPULATION LANGUAGE (DML) - IMPLICIT JOINS ............................................................... 14 15. DATA MANIPULATION LANGUAGE (DML) - NESTED JOINS ............................................................. 15 16. DATA MANIPULATION LANGUAGE (DML) - UNION AND OUTER JOIN ..................................................... 16 17. DATA MANIPULATION LANGUAGE (DML) - MINUS AND INTERSECT ...................................................... 17 18. DATA DEFINITION LANGUAGE (DDL) - VIEW DEFINITION .................................................................... 17 19. DATA DEFINITION LANGUAGE (DDL) - INDEXING .......................................................................... 18 20. DATA DEFINITION LANGUAGE (DDL) - CLUSTERING ...................................................................... 18 21. DATA MANIPULATION LANGUAGE (DML) – CHARACTER FUNCTIONS ................................................... 19 22. DATA MANIPULATION (DML) – GROUP VALUE NUMBER FUNCTIONS .......................................................... 19 23. DATA MANIPULATION LANGUAGE (DML) – WORKING WITH NULLS ...................................................... 19 24. DATA CONTROL LANGUAGE (DCL) - SECURITY CONTROL .................................................................. 19 25. SESSION CONTROL COMMANDS ................................................................................. 20 26. COMPARISON OPERATORS IN SQL ................................................................................ 20 27. WORKING WITH DATES ...................................................................................................................... 20 28. SOME USEFUL DATE FORMATS ................................................................................... 21 29. WORKING WITH NUMBERS, INSERTION AND ROUNDING ...................................... 21 30. SAMPLE SQL PROGRAM FOR FORMATTING, VIEWS AND SUBCLASSING .............................................. 23 31. DATA DICTIONARY ACCESS ........................................................................................ 26 32. CODD'S RELATIONAL RULES ........................................................................................................................... 27 33. SAMPLE DATA .................................................................................................... 28 34. ORACLE ARCHITECTURE, INSTALLATION AND USAGE ................................................................................. 30 (2) 5/13/2009 6:22 a5/p5
Image of page 2
1. REQUISITE FEATURES OF A COMPREHENSIVE RELATIONAL LANGUAGE 1. HIGH LEVEL, NONPROCEDURAL DATA LANGUAGE 2. EFFICIENT FILE STRUCTURES AND ACCESS PATHS 3. USER VIEWS 4. VALIDATION OF SEMANTIC CONSTRAINTS (INTEGRITY CONTROL) 5. EFFICIENT OPTIMIZER 6. CONCURRENCY CONTROL 7. SELECTIVE ACCESS CONTROL 8. RECOVERY 9. REPORT GENERATOR 2. DATA DEFINITION LANGUAGE (DDL) - BASIC DDL STATEMENTS CREATE TABLE - defines new table and its columns DROP TABLE - destroys table definition, contents and indexes ALTER TABLE - adds columns, modifies columns, adds/enables constraints CREATE INDEX - creates unique/non-unique indexes to speed access DROP INDEX - destroys an index CREATE VIEW - creates a logical table from one or more tables or views DROP VIEW - destroys a view 3. DATA DEFINITION LANGUAGE (DDL) - BASIC TABLE DEFINITIONS 1. CREATE TABLE tablename (column_name datatype <constraint name> <column_constraint>, column_name datatype <constraint name> <column_constraint>, <table_constraints>); /* <> indicates optional arguments */ /* SAMPLE 1 - BASIC CUSTOMER, INVOICE, PRODUCT DATABASE - NO CONSTRAINTS */ CREATE TABLE CUSTOMER ( CUSTOMER_ID number(8), FIRSTNAME varchar2(15), LASTNAME varchar2(20), BALANCE number(9,2)); CREATE TABLE INVOICE ( INVOICE_NO number(10), BILL_DATE date, BILL_TOTAL number(8,2), CUSTOMER_ID number(8)); CREATE TABLE PRODUCT ( PRODUCT_NO number(8), DESCRIPTION varchar2(20), UNIT char(4), COST
Image of page 3

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

Image of page 4
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '05
  • Shook

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern