SQL Part II - DB(1 SQL Structured Query Language Teacher...

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

View Full Document Right Arrow Icon
…………………………………………………… .... DB (1) SQL Structured Query Language Teacher Assistant : Moneer Albatta
Image of page 1

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

View Full Document Right Arrow Icon
What Is A Database? A database is a collection of data that is organized so that its contents can easily be accessed, managed, and updated. 2 2
Image of page 2
SQL Statements SELECT INSERT UPDATE DELETE CREATE ALTER DROP RENAME TRUNCATE COMMENT GRANT REVOKE COMMIT ROLLBACK SAVEPOINT Data manipulation language (DML) Data definition language (DDL) Transaction control Data control language (DCL)
Image of page 3

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

View Full Document Right Arrow Icon
The Human Resources (HR) Schema DEPARTMENTS department_id department_name manager_id location_id LOCATIONS location_id street_address postal_code city state_province country_id COUNTRIES country_id country_name region_id REGIONS region_id region_name EMPLOYEES employee_id first_name last_name email phone_number hire_date job_id salary commission_pct manager_id department_id JOBS job_id job_title min_salary max_salary JOB_HISTORY employee_id start_date end_date job_id department_id 5
Image of page 4
Creating Tables Create the table: Confirm table creation: DESCRIBE dept CREATE TABLE dept (deptno NUMBER(2), dname VARCHAR2(14), loc VARCHAR2(13), create_date DATE DEFAULT SYSDATE); 73
Image of page 5

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

View Full Document Right Arrow Icon
Data Types Raw binary data RAW and LONG RAW Binary data (up to 4 GB) BLOB Binary data stored in an external file (up to 4 GB) BFILE Date and time values DATE Variable-length character data (up to 2 GB) LONG Character data (up to 4 GB) CLOB A base-64 number system representing the unique address of a row in its table ROWID Fixed-length character data CHAR( size ) Variable-length numeric data NUMBER( p , s) Variable-length character data VARCHAR2( size ) Description Data Type
Image of page 6
ALTER TABLE Statement Use the ALTER TABLE statement to: Add a new column Modify an existing column definition Define a default value for the new column Drop a column Rename a column Change table to read-only status
Image of page 7

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

View Full Document Right Arrow Icon
Dropping a Table Moves a table to the recycle bin Invalidates dependent objects and removes object privileges on the table DROP TABLE dept80;
Image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ 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