SQL

Card Set Information

Author:
jrodriguez4324
ID:
278104
Filename:
SQL
Updated:
2014-07-04 18:45:56
Tags:
SQL
Folders:

Description:
Structured Query Language
Show Answers:

Home > Flashcards > Print Preview

The flashcards below were created by user jrodriguez4324 on FreezingBlue Flashcards. What would you like to do?


  1. Structured Query Language
    Originally developed by IBM as the SEQUEL language in the 1970s– SQL-92 is an ANSI national standard adopted in 1992– SQL:2008 is current standard
  2. SQL Defined
    SQL is not a programming language, but rather a data sub-language• SQL is comprised of– A data definition language (DDL)• Used to define database structures– A data manipulation language (DML)• Data definition and updating• Data retrieval (Queries)– There are other SQL functions not covered in this chapter• Concurrency control [See Chapter 6]• Transaction control [See Chapter 6
  3. The SQL data definition statements include
    – CREATE• To create database objects– ALTER• To modify the structure and/or characteristics of database objects– DROP• To delete database objects
  4. Creating database tables
    – The SQL CREATE TABLE statementCREATE TABLE EMPLOYEE(EmpID Integer PRIMARY KEY,EmpName Char(25)NOT NULL);
  5. CREATE with CONSTRAINT I
    • Creating database tables with PRIMARY KEY constraints– The SQL CREATE TABLE statement– The SQL CONSTRAINT keyword
    • CREATE TABLE
    • EMPLOYEE(
    • EmpIDInteger NOT NULL,
    • EmpNameChar(25) NOT NULLCONSTRAINT Emp_PKPRIMARY KEY(EmpID)
    • );
  6. CREATE with CONSTRAINT II
    • Creating database tables with composite primary keys using PRIMARY KEY constraints
    • – The SQL CREATE TABLE statement– The SQL CONSTRAINT keywordCREATE TABLE EMP_SKILL(EmpID Integer NOT NULL,SkillID Integer NOT NULL,
    • SkillLevel IntegerNULL,
    • CONSTRAINT EmpSkill_PK PRIMARY KEY
    • (EmpID, SkillID)
    • );
  7. CREATE with CONSTRAINT III
    Creating database tables using PRIMARY KEY and FOREIGN KEY constraints– The SQL CREATE TABLE statement– The SQL CONSTRAINT keyword
    • CREATE TABLE EMP_SKILL(
    • EmpID Integer NOT NULL,
    • SkillID Integer NOT NULL,
    • SkillLevel IntegerNULL,
    • CONSTRAINT EmpSkill_PK PRIMARY KEY(EmpID, SkillID),

    CONSTRAINT Emp_FKFOREIGN KEY(EmpID)REFERENCES EMPLOYEE(EmpID),

    • CONSTRAINT Skill_FK FOREIGN KEY(SkillID)REFERENCES SKILL(SkillID)
    • );
  8. CREATE with CONSTRAINT IV

    Creating database tables using PRIMARY KEY and FOREIGN KEY constraints
    – The SQL CREATE TABLE statement– The SQL CONSTRAINT keyword– ON UPDATE CASCADE and ON DELETE CASCADE
    • CREATE TABLE EMP_SKILL(
    • EmpID Integer NOT NULL,
    • SkillID Integer NOT NULL,
    • SkillLevel Integer NULL,

    CONSTRAINT EmpSkill_PK PRIMARY KEY(EmpID, SkillID),

    CONSTRAINT Emp_FKFOREIGN KEY(EmpID)REFERENCES EEMPLOYEE(EmpID)ON DELETE CASCADE,

    CONSTRAINT Skill_FK FOREIGN KEY(SkillID)REFERENCES SKILL(SkillID)ON UPDATE CASCADE);
  9. Primary Key Constraint:ALTER I
    Adding primary key constraints to an existing table
    • The SQL ALTER statement
    • ALTER TABLE EMPLOYEE

    ADD CONSTRAINT Emp_PK PRIMARY KEY(EmpID);

What would you like to do?

Home > Flashcards > Print Preview