Database Programming - Section 10. Instructor Guide

Size: px
Start display at page:

Download "Database Programming - Section 10. Instructor Guide"

Transcription

1 Database Programming - Section 10 Instructor Guide

2

3 Table of Contents...1 Lesson 1 - Defining NOT NULL and UNIQUE Constraints...1 What Will I Learn?...2 Why Learn It? Try It / Solve It...13 Lesson 2 - PRIMARY KEY, FOREIGN KEY, and CHECK Constraints...16 What Will I Learn?...17 Why Learn It? Try It / Solve It...28 Lesson 3 - Managing Constraints...32 What Will I Learn?...33 Why Learn It? Try It / Solve It...48 Lesson 4 - Practice Exercises and Review...54 What Will I Learn?...55 Why Learn It? Try It / Solve It...58 Lesson 5 - Practice Exercises and Quiz...60 What Will I Learn?...61 Why Learn It? Try It / Solve It...64 Page i

4

5 Lesson 1 - Defining NOT NULL and UNIQUE Constraints Lesson 1 - Defining NOT NULL and UNIQUE Constraints Lesson Preparation Giving constraints meaningful names is important for later documentation. Enforce and practice the naming conventions that apply to all types of constraints: table name_column name_constraint type. For example, a primary-key constraint on the employee_id column of the employees table would be named: emp_emp_id_pk. What to Watch For Students may have trouble distinguishing between the constraint definitions at the column or table level. Defining constraints will create many syntax errors if not coded carefully. Show students the details of the CREATE TABLE statement: commas end each column definition; parentheses enclose the column definitions; constraint names incorporate underscores if they are made up of more than one word. For example: g_loc_address_pk. Connections Practice the CREATE TABLE statement with entity diagrams from data modeling such as the ERD from the Animal Shelter activity. Page 1

6 What Will I Learn? What Will I Learn? Page 2

7 Why Learn It? Why Learn It? Why Learn It? Share with students other constraints we live with in everyday life. Ask students for their own constraints! - You can't be absent more than three days from school. - You can't access the computer network without entering a username and/or password. - You can't be put on the graduation list with null credits. - You can't have the same student identification number as someone else. Page 3

8 Begin this lesson with a review question: How would you add a new column called birth date to 'MY_TABLE'? ALTER TABLE my_table ADD (birth_date DATE); Read the introduction to introduce constraints. Page 4

9 Review the CREATE TABLE syntax with students. Point out that we cannot tell which columns are the primary or foreign-key columns. Page 5

10 Explain that "column level" simply refers to where the constraint is named. Reinforce the naming conventions for constraints and insist that students use them. There are other variations of naming; show students what you expect. Give students the following examples and ask them to create constraint names. Answers will vary. The salary column in the employees table: emp_sal The last_name column in the f_staffs table: f_staffs_last_name The song_id column in the d_track_listings table: d_song_d_track_list Primary-key constraint: tablename_column_name_pk Foreign-key constraint: tablename_column_name_fk Unique-key constraint: tablename_column_name_uk Composite unique-key constraint: tablename_tablename_uk UNIQUE(tablename,tablename) NOT NULL tablename_column_name_nn Page 6

11 Explain that "column level" simply refers to where the constraint is named. Reinforce the naming conventions for constraints and insist that students use them. There are other variations of naming; show students what you expect. Give students the following examples and ask them to create constraint names. Answers will vary. The salary column in the employees table: emp_sal The last_name column in the f_staffs table: f_staffs_last_name The song_id column in the d_track_listings table: d_song_d_track_list Primary-key constraint: tablename_column_name_pk Foreign-key constraint: tablename_column_name_fk Unique-key constraint: tablename_column_name_uk Composite unique-key constraint: tablename_tablename_uk UNIQUE(tablename,tablename) NOT NULL tablename_column_name_nn. Page 7

12 Review the table-level constraint syntax with students. Point out the comma that ends the column-level constraints. The table-level constraints are then listed below ending with )); Review the graphic. Ask students to write a CREATE TABLE statement that includes the NOT NULL constraint. Use the clients example shown below. In the next section, add the UNIQUE constraint on any column to demonstrate the syntax. CREATE TABLE clients (client_number NUMBER(4) NOT NULL, first_name VARCHAR2(14), last_name VARCHAR2(13)); Oracle limits the length of constraint names to 30 characters. Page 8

13 Review the Violators Beware graphic. Ask students to correct the example. Answers will vary: CREATE TABLE clients ( client_number NUMBER(6) NOT NULL, first_name VARCHAR2(20), last_name VARCHAR2(20), phone VARCHAR2(20), VARCHAR2(10) NOT NULL, CONSTRAINT clients_phone_ _uk UNIQUE( ,phone)); Alternatively, the constraint could be the following: CONSTRAINT clients_client_num_pk PRIMARY KEY (client_number)); Page 9

14 Remind students that NOT NULL means that a value must be assigned. Any value that works with the data type defined for the column can be entered. A zero or a letter or a number or even a space are considered "values." A NULL means no value. Page 10

15 Use the table graphic to show the columns. If two people lived in the same household and shared an address, an address could not be shared in this table. Each address must be unique. Page 11

16 Ask students what they think a unique constraint is and what it means. Then go through the detailed information on the slide. Ask students to give examples of composite unique-key columns. Answers will vary: city and state, last_name and , student_id and last_name Page 12

17 Try It / Solve It Try It / Solve It Try It / Solve It Answers: 1. See table. 2. See table. Page 13

18 3. CREATE TABLE global_locations ( Id NUMBER(4) CONSTRAINT g_loc_id_nn NOT NULL, loc_name VARCHAR2(20), date_opened DATE CONSTRAINT g_loc_date_nn NOT NULL, address VARCHAR2(30) CONSTRAINT g_loc_address_nn NOT NULL, city VARCHAR2(20) CONSTRAINT g_loc_city_nn NOT NULL, zip_postal_code VARCHAR2(20), phone VARCHAR2(15), VARCHAR2(15) CONSTRAINT g_loc_ _uk UNIQUE, manager_id NUMBER(4), emergency_contact VARCHAR2(20)); Page 14

19 Try It / Solve It Try It / Solve It Try It / Solve It Answers: 4. Execute the CREATE TABLE statement in HTML DB. 5. DESCRIBE global_locations; 6. CREATE TABLE global_locations ( Id NUMBER(4) CONSTRAINT g_loc_id_nn NOT NULL, loc_name VARCHAR2(20), date_opened DATE CONSTRAINT g_loc_date_nn NOT NULL, address VARCHAR2(30) CONSTRAINT g_loc_address_nn NOT NULL, city VARCHAR2(20) CONSTRAINT g_loc_city_nn NOT NULL, zip_postal_code VARCHAR2(20), phone VARCHAR2(15), VARCHAR2(15), manager_id NUMBER(4), emergency_contact VARCHAR2(20), CONSTRAINT g_loc_ _uk UNIQUE( )); Page 15

20 Lesson 2 - PRIMARY KEY, FOREIGN KEY, and CHECK Constraints Lesson 2 - PRIMARY KEY, FOREIGN KEY, and CHECK Constraints Lesson Preparation None. What to Watch For Constraint syntax may be difficult for students. Practice reading the syntax aloud in sentence form. For example: "The child table column named with a data type of has a CONSTRAINT named which references its parent table called which has a column called." Have students practice writing constraint syntax in an acceptable form. This will discourage easy shortcuts such as naming a constraint "whatever." The constraint will still work, but it s not a good practice. Connections None. Page 16

21 What Will I Learn? What Will I Learn? Page 17

22 Why Learn It? Why Learn It? Why Learn It? This is a good introduction for why you have constraints. Ask students to respond in writing to the following question: As a database developer, you are caught between what your client envisions you can do and what you know is possible to do. What kinds of constraints will you have to deal with to satisfy your customer and at the same time be able to get the job done? Possible responses: money, time, manpower, space, resistance to change, power struggles among decision makers, customer "wants" versus customer "needs," natural disasters Page 18

23 Begin this lesson with a review question. When creating a table, how do you specify a column to have a NOT NULL and UNIQUE KEY constraint? client_number NUMBER(7) NOT NULL client_number NUMBER(7) CONSTRAINT clients_client_num_d_clients_nn NOT NULL Page 19

24 Make sure students know that the column level simply refers to the area in the CREATE TABLE statement where the columns are defined. The table level refers to the last lines in the statement below where the individual column are defined. Page 20

25 To help students remember the syntax for a FOREIGN KEY, restate the column-level syntax as "The child table column named with a data type of has a CONSTRAINT named which references its parent table called which has a column called." For the table-level foreign-key constraint, restate the syntax as "There is a table-level CONSTRAINT named which is a FOREIGN KEY (in the table); it REFERENCES the parent table (which has a column named )." Page 21

26 Use the tables to explain referential integrity. Ask students for other examples of primary key - foreign key relationships in the DJ on Demand and Global Fast Foods databases. Page 22

27 Use the examples shown to review the syntax for defining foreign-key constraints at the column and table level. Page 23

28 Page 24

29 Page 25

30 Use the example shown. Ask students to determine what each constraint is limiting. Answer: cd_numbers must be between 10 and 999; year must be greater than 1996; the producer must be in the list shown. Page 26

31 Create challenges that require students to first find out what columns in the database tables are designated as primary, foreign, or check. Use the table's primary-foreign key relationships to write out the constraint syntax. Students should be able to create names for their constraints. The student-named constraints may not be exactly like the HTML DB listings, but that's to be expected. Ask students what they think a check constraint is, based on the name. Page 27

32 Try It / Solve It Try It / Solve It Try It / Solve It Answers: 1. To prevent mistakes, students should write this out on paper or in a word-processing program before creating the tables. animal_id NUMBER(6) name VARCHAR2(25) license_tag_number NUMBER(10) admit_date DATE adoption_id NUMBER(5), vaccination_date DATE Page 28

33 2. CREATE TABLE animals ( animal_id NUMBER(6), name VARCHAR2(25), license_tag_number NUMBER(10), admit_date DATE CONSTRAINT animals_admit_nn NOT NULL, adoption_id NUMBER(5), vaccination_date DATE CONSTRAINT animals_vacc_nn NOT NULL, CONSTRAINT animal_id_pk PRIMARY KEY(animal_id), CONSTRAINT lic_tag_num_uk UNIQUE (license_tag_number)); Page 29

34 Try It / Solve It Try It / Solve It Try It / Solve It Answers: 3. INSERT INTO animals (animal_id, name, license_tag_number, admit_date, adoption_id, vaccination_date) VALUES (101, 'Spunky', 35540, '10-OCT-04', 205, '12-OCT-04'); 4. Column level: adoption_id NUMBER(5) CONSTRAINT adopt_date_fk REFERENCES adoptions(adoption_id); Table level: CONSTRAINT adopt_date_fk FOREIGN KEY(adoption_id) REFERENCES adoptions (adoption_id); Page 30

35 Try It / Solve It Try It / Solve It Try It / Solve It Answers: 5. See student content. Explain that a pseudocolumn behaves like a table column but is not actually stored in the table. You can select from pseudocolumns, but you cannot insert, update, or delete their values. Pseudocolumns (CURRVAL and NEXTVAL, ROWID, ROWNUM) will be used in the Section 15, Lesson 3 sequences. In constraint types listed in the data dictionary, C stands for CHECK, P for PRIMARY KEY, R for REFERENTIAL INTEGRITY, and U for UNIQUE. Page 31

36 Lesson 3 - Managing Constraints Lesson 3 - Managing Constraints Lesson Preparation None. What to Watch For Help students understand referential integrity and the process of altering constraints. Students will get involved in the syntax and not understand the bigger picture. Connections Relate the managing of constraints to the work students completed in making ERDs in data modeling. Making sure the correct relationships are identified for all tables is important. In the design of the physical database, the relationships map directly to the constraints for columns in tables. If the correct relationships are not established in the design stage, it may be difficult or impossible to add constraints after data has been entered in the tables. Deleting data to add constraints would not be desirable. Page 32

37 What Will I Learn? What Will I Learn? What Will I Learn? This section's objectives deal with constraint management -- the ability of a DBA to add, modify, enable, disable, or drop constraints. Constraints do the following: - Enforce rules on the data in a table whenever a table row is inserted, updated, or deleted. - Prevent the deletion of a table if there are dependencies from other tables. - Provide rules for Oracle tools, such as Oracle Forms Developer. Page 33

38 Why Learn It? Why Learn It? Page 34

39 Show students each required element in the syntax. Page 35

40 Page 36

41 Explain the syntax in the example shown. Ask students why ON DELETE CASCADE was added to the foreign-key constraint. Answer: to enable the parent key to be deleted if there is data in the child foreign-key column. Use other tables from the DJ on Demand database such as the foreign-key column song_id in D_PLAY_LIST_ITEMS to practice the foreign-key syntax. Page 37

42 Page 38

43 To drop the primary-key constraint on the D_CLIENTS table, the word CASCADE is used to disable the foreign- key constraint in the child tabl ALTER TABLE c_clients DROP PRIMARY KEY CASCADE; Note: Since there is only one primary key for a table, we did not have to specify the column name. Page 39

44 Explain the syntax in the examples shown. Ask students to give an example where it might be necessary to disable a constraint in the D_CLIENTS table. Event data needs to be entered in the child D_EVENTS table, but the client_number is not known as yet. Use the SELECT statement syntax to view USER_CONSTRAINTS and USER_CONS_COLUMNS. Although creating indices is not included in this course, students may ask what they are. Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes; they are just used to speed up queries. The following syntax is used to create a unique index on a table. A unique index means that two rows cannot have the same index value. When a primary key is created, a unique index is automatically created. In Oracle9i, the index used to support primary and unique keys can be defined independently of the constraint itself by using the CREATE INDEX syntax within the USING INDEX clause of the CREATE TABLE statement: Page 40

45 CREATE TABLE student ( student_id NUMBER(6), student_name VARCHAR2(30), course_no NUMBER(2), CONSTRAINT student_student_id_pk PRIMARY KEY(student_id) USING INDEX (CREATE INDEX student_student_pk_idx ON employee(student_id)) ); Once defined, the unique constraint can be dropped without dropping the index. ALTER TABLE student DROP PRIMARY KEY KEEP INDEX; ALTER TABLE student DROP CONSTRAINT student_student_id_pk; CREATE UNIQUE INDEX index_name ON table_name (column_name to be indexed) Page 41

46 Explain the syntax in the examples shown. Ask students to give an example where it might be necessary to disable a constraint in the D_CLIENTS table. Event data needs to be entered in the child D_EVENTS table, but the client_number is not known as yet. Use the SELECT statement syntax to view USER_CONSTRAINTS and USER_CONS_COLUMNS. Although creating indices is not included in this course, students may ask what they are. Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes; they are just used to speed up queries. The following syntax is used to create a unique index on a table. A unique index means that two rows cannot have the same index value. When a primary key is created, a unique index is automatically created. In Oracle9i, the index used to support primary and unique keys can be defined independently of the constraint itself by using the CREATE INDEX syntax within the USING INDEX clause of the CREATE TABLE statement: Page 42

47 CREATE TABLE student ( student_id NUMBER(6), student_name VARCHAR2(30), course_no NUMBER(2), CONSTRAINT student_student_id_pk PRIMARY KEY(student_id) USING INDEX (CREATE INDEX student_student_pk_idx ON employee(student_id)) ); Once defined, the unique constraint can be dropped without dropping the index. ALTER TABLE student DROP PRIMARY KEY KEEP INDEX; ALTER TABLE student DROP CONSTRAINT student_student_id_pk; CREATE UNIQUE INDEX index_name ON table_name (column_name to be indexed) Page 43

48 Explain that in our previous example, the primary key was DISABLED with the CASCADE option. In this ENABLE statement, the foreign key in the D_EVENTS client_number column will not be enabled. Ask students how they could reestablish the D_EVENTS client_number foreign-key constraint. Answer: Use the ALTER TABLE ADD CONSTRAINT syntax. Page 44

49 Page 45

50 Students need to know how to use the SELECT statement to view the data dictionary constraints. Make sure they write this code so that they will be familiar with it. SELECT constraint_name, column_name FROM user_cons_columns WHERE table_name = 'EMPLOYEES'; Page 46

51 Students need to know how to use the SELECT statement to view the data dictionary constraints. Make sure they write this code so that they will be familiar with it. SELECT constraint_name, column_name FROM user_cons_columns WHERE table_name = 'EMPLOYEES'; Page 47

52 Try It / Solve It Try It / Solve It Try It / Solve It The practice exercises use the d_clients and d_events tables in the DJ on Demand database. Students will work with copies of these two tables named copy_d_clients and copy_d_events. Make sure they have new copies of the tables (without changes made from previous exercises). Remember, tables copied using a subquery do not have the integrity constraints as established in the original tables. When using the SELECT statement to view the constraint name, the tablenames must be all capital letters. Do the practice exercises one at a time. Discuss what is happening and why the error messages are generated. Help students see the bigger picture of referential integrity. Answers: 1. ALTER TABLE copy_d_clients ADD CONSTRAINT copy_d_clients_pk PRIMARY KEY(client_number); 2. ALTER TABLE copy_d_events ADD CONSTRAINT copy_d_events_fk FOREIGN KEY(client_number) REFERENCES copy_d_clients(client_number); Page 48

53 Try It / Solve It Try It / Solve It Try It / Solve It Answers: 3. SELECT constraint_name, constraint_type FROM USER_CONSTRAINTS WHERE table_name = 'COPY_D_CLIENTS'; Page 49

54 SELECT constraint_name, constraint_type FROM USER_CONSTRAINTS WHERE table_name = 'COPY_D_EVENTS'; 4. ALTER TABLE copy_d_clients DROP CONSTRAINT copy_d_clients_pk; ORA-02273: this unique/primary key is referenced by some foreign keys **A primary key cannot be dropped if there are foreign keys referencing it. Page 50

55 Try It / Solve It Try It / Solve It Try It / Solve It Answers: 5. INSERT INTO copy_d_events (id, name,event_date,description,cost,venue_id,package_code,theme_code,client_number) VALUES(140,'Cline Bas Mitzvah','15-JUL-04','Church and Private Home, formal',4500,105,87,77,7125); ORA-02291: integrity constraint (USTA_SDHS_SQL01_S01.COPY_D_EVENTS_FK) violated - parent key not found **The attempt to drop the primary-key column in the copy_d_clients table was not successful in step 4. Therefore, the attempt to insert a row that has a value in a foreign-key child column that does not have a corresponding value in a parent column will also fail. Page 51

56 6. ALTER TABLE copy_d_clients DISABLE CONSTRAINT copy_d_clients_pk; ORA-02297: cannot disable constraint (USTA_SDHS_SQL01_S01.COPY_D_CLIENTS_PK) - dependencies exist ALTER TABLE copy_d_clients DISABLE CONSTRAINT copy_d_clients_pk CASCADE; If the ALTER TABLE query did not have the CASCADE option, the FOREIGN KEY constraint was not disabled, so the ALTER TABLE DISABLE failed. If the CASCADE option was added to the ALTER TABLE query, the INSERT will be successful. Page 52

57 Try It / Solve It Try It / Solve It Try It / Solve It Answers: 7. INSERT INTO copy_d_events (id, name,event_date,description,cost,venue_id,package_code,theme_code,client_number) VALUES(140,'Cline Bas Mitzvah','15-JUL-04','Church and Private Home, formal',4500,105,87,77,7125) The primary key has been disabled, allowing values to be inserted into the copy_d_events table even though there is no corresponding client_number in the parent table copy_d_clients. 8. ALTER TABLE copy_d_clients ENABLE CONSTRAINT copy_d_clients_pk The ENABLE was successful even though the new addition in the copy_d_events table has a client number not found in the parent table. When enabling a primary key that was disabled with the CASCADE option, the foreign keys are not enabled. 9. The copy_d_clients table would need to have the client number and information added to it before the copy_d_events table could reenable the foreign-key constraint on the client_number column. Page 53

58 Lesson 4 - Practice Exercises and Review Lesson 4 - Practice Exercises and Review Lesson Preparation None. What to Watch For Constraints are challenging for students. Review each practice exercise and check for understanding. Connections None. Page 54

59 What Will I Learn? What Will I Learn? Page 55

60 Why Learn It? Why Learn It? Page 56

61 Page 57

62 Try It / Solve It Try It / Solve It Try It / Solve It Answers: Review the Study Guide and Vocabulary for this section. Students should access self-test software question(s) for review. 1. Constraints enforce rules and prevent deletion of tables when there are dependencies. 2. CHECK constraints specify a condition that must be True. Example: A negative salary amount cannot be entered in a table. 3. Query the data dictionary USER_CONSTRAINTS. 4. When a table is created or added after the table is created (depending on data already in the table). 5. The SYSn name does not explicitly name which column the constraint refers to. 6. Referential integrity prevents additions, deletions, or modifications of information that violates business rules. 7. It is really a personal preference, but NON NULL constraints must be created at the column level and composite keys at the table level. Page 58

63 Try It / Solve It Try It / Solve It Try It / Solve It Answers: 8. To prevent duplicate information in a column that is not a primary-key column 9. Yes, because nulls are not equal to anything -- just can't have identical values in nonnull columns 10. last name and address 11. one 12. nonduplicate values in a column 13. referential integrity constraint 14. ODC deletes the corresponding foreign key referenced row when parent rows are deleted 15. Release the foreign key constraint on the parent table. Page 59

64 Lesson 5 - Practice Exercises and Quiz Lesson 5 - Practice Exercises and Quiz Lesson Preparation None. What to Watch For None. Connections None. Page 60

65 What Will I Learn? What Will I Learn? Page 61

66 Why Learn It? Why Learn It? Page 62

67 Page 63

68 Try It / Solve It Try It / Solve It Try It / Solve It Complete and review the practice exercises. Assign SQL Quiz. A passing score is 7 out of 10. Assessment: You may want to encourage students to retake the quiz until they achieve a passing score. Or you may prefer to allow only one attempt at the quiz. Allow 20 minutes for the quiz and 10 minutes for assessment/discussion afterward. Have students work in in pairs to review what they missed on the quiz. Based on the types of questions they missed, have each pair of students choose one question they missed or did not understand to present to the group. Use this discussion to assess student understanding. Page 64

CIS 207 Oracle - Database Programming and SQL HOMEWORK: # 13

CIS 207 Oracle - Database Programming and SQL HOMEWORK: # 13 CIS 207 Oracle - Database Programming and SQL HOMEWORK: # 13 DUE: Run the following queries in Oracle Application Express. Paste a copy of each query Into this word document below the questions or notepad.txt

More information

Database Programming with SQL

Database Programming with SQL Database Programming with SQL 14-1 Objectives This lesson covers the following objectives: Define the term "constraint" as it relates to data integrity State when it is possible to define a constraint

More information

Database Programming - Section 7. Instructor Guide

Database Programming - Section 7. Instructor Guide Database Programming - Section 7 Instructor Guide Table of Contents...1 Lesson 1 - Multiple-Row Subqueries...1 What Will I Learn?...3 Why Learn It?...4...5 Try It / Solve It...12 Lesson 2 - Practice Exercises

More information

Using DDL Statements to Create and Manage Tables. Copyright 2004, Oracle. All rights reserved.

Using DDL Statements to Create and Manage Tables. Copyright 2004, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables Copyright 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Categorize the main database

More information

Using DDL Statements to Create and Manage Tables. Copyright 2004, Oracle. All rights reserved.

Using DDL Statements to Create and Manage Tables. Copyright 2004, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables Copyright 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Categorize the main database

More information

Using DDL Statements to Create and Manage Tables. Copyright 2006, Oracle. All rights reserved.

Using DDL Statements to Create and Manage Tables. Copyright 2006, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables Objectives After completing this lesson, you should be able to do the following: Categorize the main database objects Review the table structure List the

More information

DATA CONSTRAINT. Prepared By: Dr. Vipul Vekariya

DATA CONSTRAINT. Prepared By: Dr. Vipul Vekariya DATA CONSTRAINT Prepared By: Dr. Vipul Vekariya What is constraint? Constraints enforce rules at the table level. Constraints prevent the deletion of a table if there are dependencies. There are two types

More information

Database Foundations. 6-3 Data Definition Language (DDL) Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Database Foundations. 6-3 Data Definition Language (DDL) Copyright 2015, Oracle and/or its affiliates. All rights reserved. Database Foundations 6-3 Roadmap You are here Introduction to Oracle Application Express Structured Query Language (SQL) Data Definition Language (DDL) Data Manipulation Language (DML) Transaction Control

More information

Lecture7: SQL Overview, Oracle Data Type, DDL and Constraints Part #2

Lecture7: SQL Overview, Oracle Data Type, DDL and Constraints Part #2 IS220 : Database Fundamentals College of Computer and Information Sciences - Information Systems Dept. Lecture7: SQL Overview, Oracle Data Type, DDL and Constraints Part #2 Ref. Chapter6 Prepared by L.

More information

Database Programming - Section 11. Instructor Guide

Database Programming - Section 11. Instructor Guide Database Programming - Section 11 Instructor Guide Table of Contents...1 Lesson 1 - In-Class Interview...1 What Will I Learn?...3 Why Learn It?...4...5 Try It / Solve It...9 Lesson 2 - Creating Views...12

More information

Lecture7: SQL Overview, Oracle Data Type, DDL and Constraints Part #2

Lecture7: SQL Overview, Oracle Data Type, DDL and Constraints Part #2 Lecture7: SQL Overview, Oracle Data Type, DDL and Constraints Part #2 Ref. Chapter6 Prepared by L. Nouf Almujally & Aisha AlArfaj& L.Fatima Alhayan Colleg Comp Informa Scien Informa Syst D 1 IS220 : Database

More information

CHAPTER4 CONSTRAINTS

CHAPTER4 CONSTRAINTS CHAPTER4 CONSTRAINTS LEARNING OBJECTIVES After completing this chapter, you should be able to do the following: Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN KEY,

More information

Database Programming - Section 18. Instructor Guide

Database Programming - Section 18. Instructor Guide Database Programming - Section 18 Instructor Guide Table of Contents...1 Lesson 1 - Certification Exam Preparation...1 What Will I Learn?...2 Why Learn It?...3 Tell Me / Show Me...4 Try It / Solve It...5

More information

Limit Rows Selected. Copyright 2008, Oracle. All rights reserved.

Limit Rows Selected. Copyright 2008, Oracle. All rights reserved. What Will I Learn? In this lesson, you will learn to: Apply SQL syntax to restrict the rows returned from a query Demonstrate application of the WHERE clause syntax Explain why it is important, from a

More information

A <column constraint> is a constraint that applies to a single column.

A <column constraint> is a constraint that applies to a single column. Lab 7 Aim: Creating Simple tables in SQL Basic Syntax for create table command is given below: CREATE TABLE ( [DEFAULT ] [], {

More information

Database Programming - Section 1. Instructor Guide

Database Programming - Section 1. Instructor Guide Database Programming - Section 1 Instructor Guide Table of Contents...1 Lesson 1 - Case and Character Manipulation...1 What Will I Learn?...2 Why Learn It?...3...4 Try It / Solve It...10 Lesson 2 - Number

More information

DUE: CD_NUMBER TITLE PRODUCER YEAR 97 Celebrate the Day R & B Inc Holiday Tunes for All Tunes are US 2004

DUE: CD_NUMBER TITLE PRODUCER YEAR 97 Celebrate the Day R & B Inc Holiday Tunes for All Tunes are US 2004 CIS 207 Oracle - Database Programming and SQL HOMEWORK: # 12 DUE: Run the following queries in Oracle Application Express. Paste a copy of each query Into this word document below the questions, save and

More information

Lecture 07. Spring 2018 Borough of Manhattan Community College

Lecture 07. Spring 2018 Borough of Manhattan Community College Lecture 07 Spring 2018 Borough of Manhattan Community College 1 SQL Identifiers SQL identifiers are used to identify objects in the database, such as table names, view names, and columns. The ISO standard

More information

Table of Contents. PDF created with FinePrint pdffactory Pro trial version

Table of Contents. PDF created with FinePrint pdffactory Pro trial version Table of Contents Course Description The SQL Course covers relational database principles and Oracle concepts, writing basic SQL statements, restricting and sorting data, and using single-row functions.

More information

Consistency The DBMS must ensure the database will always be in a consistent state. Whenever data is modified, the database will change from one

Consistency The DBMS must ensure the database will always be in a consistent state. Whenever data is modified, the database will change from one Data Management We start our studies of Computer Science with the problem of data storage and organization. Nowadays, we are inundated by data from all over. To name a few data sources in our lives, we

More information

Database Programming with SQL

Database Programming with SQL Database Programming with SQL 2-1 Objectives This lesson covers the following objectives: Apply the concatenation operator to link columns to other columns, arithmetic expressions, or constant values to

More information

Database Programming - Section 3. Instructor Guide

Database Programming - Section 3. Instructor Guide Database Programming - Section 3 Instructor Guide Table of Contents...1 Lesson 1 - Destinations: What's in My Future?...1 What Will I Learn?...3 Why Learn It?...4 Tell Me / Show Me...5 Try It / Solve

More information

Working with Columns, Characters and Rows. Copyright 2008, Oracle. All rights reserved.

Working with Columns, Characters and Rows. Copyright 2008, Oracle. All rights reserved. Working with Columns, Characters and Rows What Will I Learn? In this lesson, you will learn to: Apply the concatenation operator to link columns to other columns, arithmetic expressions or constant values

More information

Creating and Managing Tables Schedule: Timing Topic

Creating and Managing Tables Schedule: Timing Topic 9 Creating and Managing Tables Schedule: Timing Topic 30 minutes Lecture 20 minutes Practice 50 minutes Total Objectives After completing this lesson, you should be able to do the following: Describe the

More information

Indexes (continued) Customer table with record numbers. Source: Concepts of Database Management

Indexes (continued) Customer table with record numbers. Source: Concepts of Database Management 12 Advanced Topics Objectives Use indexes to improve database performance Examine the security features of a DBMS Discuss entity, referential, and legal-values integrity Make changes to the structure of

More information

Data Modelling and Databases. Exercise Session 7: Integrity Constraints

Data Modelling and Databases. Exercise Session 7: Integrity Constraints Data Modelling and Databases Exercise Session 7: Integrity Constraints 1 Database Design Textual Description Complete Design ER Diagram Relational Schema Conceptual Modeling Logical Modeling Physical Modeling

More information

Course Outline and Objectives: Database Programming with SQL

Course Outline and Objectives: Database Programming with SQL Introduction to Computer Science and Business Course Outline and Objectives: Database Programming with SQL This is the second portion of the Database Design and Programming with SQL course. In this portion,

More information

Database Foundations. 6-4 Data Manipulation Language (DML) Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Database Foundations. 6-4 Data Manipulation Language (DML) Copyright 2015, Oracle and/or its affiliates. All rights reserved. Database Foundations 6-4 Roadmap You are here Introduction to Oracle Application Express Structured Query Language (SQL) Data Definition Language (DDL) Data Manipulation Language (DML) Transaction Control

More information

Database Programming with SQL

Database Programming with SQL Database Programming with SQL 13-1 Objectives In this lesson, you will learn to: List and categorize the main database objects Review a table structure Describe how schema objects are used by the Oracle

More information

Database Programming - Section 8. Instructor Guide

Database Programming - Section 8. Instructor Guide Database Programming - Section 8 Instructor Guide Table of Contents...1 Lesson 1 - DEFAULT Values and the MERGE Statement...1 What Will I Learn?...3 Why Learn It?...4 Tell Me / Show Me...5 Try It / Solve

More information

Oracle Database 10g: SQL Fundamentals I. Oracle Internal & Oracle Academy Use Only. Student Guide Volume 2. D17108GC30 Edition 3.0 January 2009 D57871

Oracle Database 10g: SQL Fundamentals I. Oracle Internal & Oracle Academy Use Only. Student Guide Volume 2. D17108GC30 Edition 3.0 January 2009 D57871 D17108GC30 Edition 3.0 January 2009 D57871 Oracle Database 10g: SQL Fundamentals I Student Guide Volume 2 Authors Salome Clement Chaitanya Koratamaddi Nancy Greenberg Technical Contributors and Reviewers

More information

3.1. Keys: Super Key, Candidate Key, Primary Key, Alternate Key, Foreign Key

3.1. Keys: Super Key, Candidate Key, Primary Key, Alternate Key, Foreign Key Unit 3: Types of Keys & Data Integrity 3.1. Keys: Super Key, Candidate Key, Primary Key, Alternate Key, Foreign Key Different Types of SQL Keys A key is a single or combination of multiple fields in a

More information

Introduction to Computer Science and Business

Introduction to Computer Science and Business Introduction to Computer Science and Business This is the second portion of the Database Design and Programming with SQL course. In this portion, students implement their database design by creating a

More information

Oracle Database 10g Express

Oracle Database 10g Express Oracle Database 10g Express This tutorial prepares the Oracle Database 10g Express Edition Developer to perform common development and administrative tasks of Oracle Database 10g Express Edition. Objectives

More information

Chapter 7. Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel

Chapter 7. Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel 1 In this chapter, you will learn: The basic commands

More information

chapter 2 G ETTING I NFORMATION FROM A TABLE

chapter 2 G ETTING I NFORMATION FROM A TABLE chapter 2 Chapter G ETTING I NFORMATION FROM A TABLE This chapter explains the basic technique for getting the information you want from a table when you do not want to make any changes to the data and

More information

Database Design - Section 11. Instructor Guide

Database Design - Section 11. Instructor Guide Instructor Guide Table of Contents...1 Lesson 1 - What About Me?...1 What Will I Learn?...2 Why Learn It?...3...4 Try It / Solve It...5 Lesson 2 - Drawing Conventions for Readability...6 What Will I Learn?...7

More information

Vendor: Oracle. Exam Code: 1Z Exam Name: Oracle Database: SQL Fundamentals I. Q&As: 292

Vendor: Oracle. Exam Code: 1Z Exam Name: Oracle Database: SQL Fundamentals I. Q&As: 292 Vendor: Oracle Exam Code: 1Z1-051 Exam Name: Oracle Database: SQL Fundamentals I Q&As: 292 QUESTION 1 Evaluate the SQL statement: TRUNCATE TABLE DEPT; Which three are true about the SQL statement? (Choose

More information

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. # 13 Constraints & Triggers Hello and welcome to another session

More information

Relational Model. IT 5101 Introduction to Database Systems. J.G. Zheng Fall 2011

Relational Model. IT 5101 Introduction to Database Systems. J.G. Zheng Fall 2011 Relational Model IT 5101 Introduction to Database Systems J.G. Zheng Fall 2011 Overview What is the relational model? What are the most important practical elements of the relational model? 2 Introduction

More information

Oracle MOOC: SQL Fundamentals

Oracle MOOC: SQL Fundamentals Week 4 Homework for Lesson 4 Homework is your chance to put what you've learned in this lesson into practice. This homework is not "graded" and you are encouraged to write additional code beyond what is

More information

QUETZALANDIA.COM. 5. Data Manipulation Language

QUETZALANDIA.COM. 5. Data Manipulation Language 5. Data Manipulation Language 5.1 OBJECTIVES This chapter involves SQL Data Manipulation Language Commands. At the end of this chapter, students should: Be familiar with the syntax of SQL DML commands

More information

Data Definition Language (DDL)

Data Definition Language (DDL) Islamic University of Gaza Faculty of Engineering Computer Engineering Dept. Database Lab (ECOM 4113) Lab 6 Data Definition Language (DDL) Eng. Mohammed Alokshiya November 11, 2014 Database Keys A key

More information

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 7 Introduction to Structured Query Language (SQL)

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management Tenth Edition Chapter 7 Introduction to Structured Query Language (SQL) Objectives In this chapter, students will learn: The basic commands and

More information

Creating Other Schema Objects

Creating Other Schema Objects Creating Other Schema Objects Objectives After completing this lesson, you should be able to do the following: Create simple and complex views Retrieve data from views Database Objects Object Table View

More information

Creating Other Schema Objects. Copyright 2004, Oracle. All rights reserved.

Creating Other Schema Objects. Copyright 2004, Oracle. All rights reserved. Creating Other Schema Objects Copyright 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Create simple and complex views Retrieve data

More information

Introduction to Relational Database Concepts. Copyright 2011, Oracle. All rights reserved.

Introduction to Relational Database Concepts. Copyright 2011, Oracle. All rights reserved. Introduction to Relational Database Concepts Copyright 2011, Oracle. All rights reserved. What Will I Learn? Objectives In this lesson, you will learn to: Define a primary key Define a foreign key Define

More information

Chapter # 7 Introduction to Structured Query Language (SQL) Part I

Chapter # 7 Introduction to Structured Query Language (SQL) Part I Chapter # 7 Introduction to Structured Query Language (SQL) Part I Introduction to SQL SQL functions fit into two broad categories: Data definition language Data manipulation language Basic command set

More information

Cartesian Product and the Join Operations. Copyright 2008, Oracle. All rights reserved.

Cartesian Product and the Join Operations. Copyright 2008, Oracle. All rights reserved. What Will I Learn? In this lesson, you will learn to: Describe the purpose of join conditions Construct and execute a SELECT statement that results in a Cartesian product Construct and execute SELECT statements

More information

ITCertMaster. Safe, simple and fast. 100% Pass guarantee! IT Certification Guaranteed, The Easy Way!

ITCertMaster.   Safe, simple and fast. 100% Pass guarantee! IT Certification Guaranteed, The Easy Way! ITCertMaster Safe, simple and fast. 100% Pass guarantee! http://www.itcertmaster.com Exam : 1z0-007 Title : Introduction to Oracle9i: SQL Vendor : Oracle Version : DEMO Get Latest & Valid 1Z0-007 Exam's

More information

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng.

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng. Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng. Ahmed Abumarasa Database Lab Lab 2 Database Table Introduction: The previous

More information

Getting Information from a Table

Getting Information from a Table ch02.fm Page 45 Wednesday, April 14, 1999 2:44 PM Chapter 2 Getting Information from a Table This chapter explains the basic technique of getting the information you want from a table when you do not want

More information

Interview Questions on DBMS and SQL [Compiled by M V Kamal, Associate Professor, CSE Dept]

Interview Questions on DBMS and SQL [Compiled by M V Kamal, Associate Professor, CSE Dept] Interview Questions on DBMS and SQL [Compiled by M V Kamal, Associate Professor, CSE Dept] 1. What is DBMS? A Database Management System (DBMS) is a program that controls creation, maintenance and use

More information

Updating Column Values and Deleting Rows. Copyright 2008, Oracle. All rights reserved.

Updating Column Values and Deleting Rows. Copyright 2008, Oracle. All rights reserved. Updating Column Values and Deleting Rows What Will I Learn? In this lesson, you will learn to: Construct and execute an UPDATE statement Construct and execute a DELETE statement Construct and execute a

More information

SQL is an English like language consisting of commands to store, retrieve, maintain & regulate access to your database.

SQL is an English like language consisting of commands to store, retrieve, maintain & regulate access to your database. SQL SQL is an English like language consisting of commands to store, retrieve, maintain & regulate access to your database. SQL*Plus SQL*Plus is an application that recognizes & executes SQL commands &

More information

Using the Set Operators. Copyright 2006, Oracle. All rights reserved.

Using the Set Operators. Copyright 2006, Oracle. All rights reserved. Using the Set Operators Objectives After completing this lesson, you should be able to do the following: Describe set operators Use a set operator to combine multiple queries into a single query Control

More information

ÇALIŞMA TEST SORULARI

ÇALIŞMA TEST SORULARI 1. A table has the following definition: EMPLOYEES( EMPLOYEE_ID NUMBER(6) NOT NULL, LAST_NAME VARCHAR2(10) NOT NULL, MANAGER_ID VARCHAR2(6)) and contains the following rows: (1001, 'Bob Bevan', '200')

More information

BraindumpsVCE. Best vce braindumps-exam vce pdf free download

BraindumpsVCE.   Best vce braindumps-exam vce pdf free download BraindumpsVCE http://www.braindumpsvce.com Best vce braindumps-exam vce pdf free download Exam : 1z1-061 Title : Oracle Database 12c: SQL Fundamentals Vendor : Oracle Version : DEMO Get Latest & Valid

More information

The Relational Model

The Relational Model The Relational Model What is the Relational Model Relations Domain Constraints SQL Integrity Constraints Translating an ER diagram to the Relational Model and SQL Views A relational database consists

More information

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data. Managing Data Data storage tool must provide the following features: Data definition (data structuring) Data entry (to add new data) Data editing (to change existing data) Querying (a means of extracting

More information

SQL functions fit into two broad categories: Data definition language Data manipulation language

SQL functions fit into two broad categories: Data definition language Data manipulation language Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition Chapter 7 Beginning Structured Query Language (SQL) MDM NUR RAZIA BINTI MOHD SURADI 019-3932846 razia@unisel.edu.my

More information

COSC 304 Introduction to Database Systems SQL DDL. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 304 Introduction to Database Systems SQL DDL. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 304 Introduction to Database Systems SQL DDL Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca SQL Overview Structured Query Language or SQL is the standard query language

More information

Database Design. 9-2 Basic Mapping: The Transformation Process. Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Database Design. 9-2 Basic Mapping: The Transformation Process. Copyright 2015, Oracle and/or its affiliates. All rights reserved. Database Design 9-2 Objectives This lesson covers the following objectives: Distinguish between a conceptual model and a physical model Apply terminology mapping between the two models Understand and apply

More information

INFSCI 2710 Database Management Solution to Final Exam

INFSCI 2710 Database Management Solution to Final Exam Dr. Stefan Brass May 8, 2000 School of Information Sciences University of Pittsburgh INFSCI 2710 Database Management Solution to Final Exam Statistics The average points reached (out of 42) were 32 (77%),

More information

Item: 1 (Ref:Cert-1Z )

Item: 1 (Ref:Cert-1Z ) Page 1 of 13 Item: 1 (Ref:Cert-1Z0-071.10.2.1) Evaluate this CREATE TABLE statement: CREATE TABLE customer ( customer_id NUMBER, company_id VARCHAR2(30), contact_name VARCHAR2(30), contact_title VARCHAR2(20),

More information

Tables From Existing Tables

Tables From Existing Tables Creating Tables From Existing Tables After completing this module, you will be able to: Create a clone of an existing table. Create a new table from many tables using a SQL SELECT. Define your own table

More information

Physical Design of Relational Databases

Physical Design of Relational Databases Physical Design of Relational Databases Chapter 8 Class 06: Physical Design of Relational Databases 1 Physical Database Design After completion of logical database design, the next phase is the design

More information

School of Computing and Information Technology. Examination Paper Autumn Session 2017

School of Computing and Information Technology. Examination Paper Autumn Session 2017 School of Computing and Information Technology CSIT115 Data Management and Security Wollongong Campus Student to complete: Family name Other names Student number Table number Examination Paper Autumn Session

More information

SQL: Part III. Announcements. Constraints. CPS 216 Advanced Database Systems

SQL: Part III. Announcements. Constraints. CPS 216 Advanced Database Systems SQL: Part III CPS 216 Advanced Database Systems Announcements 2 Reminder: Homework #1 due in 12 days Reminder: reading assignment posted on Web Reminder: recitation session this Friday (January 31) on

More information

Basic Mapping: The Transformation Process. Copyright 2011, Oracle. All rights reserved.

Basic Mapping: The Transformation Process. Copyright 2011, Oracle. All rights reserved. Basic Mapping: The Transformation Process Copyright 2011, Oracle. All rights reserved. What Will I Learn? Objectives In this lesson, you will learn to: Distinguish entity relationship models from database

More information

Oracle Syllabus Course code-r10605 SQL

Oracle Syllabus Course code-r10605 SQL Oracle Syllabus Course code-r10605 SQL Writing Basic SQL SELECT Statements Basic SELECT Statement Selecting All Columns Selecting Specific Columns Writing SQL Statements Column Heading Defaults Arithmetic

More information

Triggers- View-Sequence

Triggers- View-Sequence The Islamic University of Gaza Faculty of Engineering Dept. of Computer Engineering Database Lab (ECOM 4113) Lab 9 Triggers- View-Sequence Eng. Ibraheem Lubbad Triggers: A trigger is a PL/SQL block or

More information

CS 275 Winter 2011 Problem Set 3

CS 275 Winter 2011 Problem Set 3 CS 275 Winter 2011 Problem Set 3 Run the following quires in Oracle Application Express where appropriate. Cut and paste your query for each applicable question. For short answer or multiple choice type

More information

Lab # 6. Using Subqueries and Set Operators. Eng. Alaa O Shama

Lab # 6. Using Subqueries and Set Operators. Eng. Alaa O Shama The Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Database Lab Lab # 6 Using Subqueries and Set Operators Eng. Alaa O Shama November, 2015 Objectives:

More information

SQL: Concepts. Todd Bacastow IST 210: Organization of Data 2/17/ IST 210

SQL: Concepts. Todd Bacastow IST 210: Organization of Data 2/17/ IST 210 SQL: Concepts Todd Bacastow IST 210: Organization of Data 2/17/2004 1 Design questions How many entities are there? What are the major entities? What are the attributes of each entity? Is there a unique

More information

Exam code: Exam name: Database Fundamentals. Version 16.0

Exam code: Exam name: Database Fundamentals. Version 16.0 98-364 Number: 98-364 Passing Score: 800 Time Limit: 120 min File Version: 16.0 Exam code: 98-364 Exam name: Database Fundamentals Version 16.0 98-364 QUESTION 1 You have a table that contains the following

More information

Intermediate SQL ( )

Intermediate SQL ( ) CSL 451 Introduction to Database Systems Intermediate SQL (4.1-4.4) Department of Computer Science and Engineering Indian Institute of Technology Ropar Narayanan (CK) Chatapuram Krishnan! Summary Join

More information

CIS Slightly-different version of Week 10 Lab, also intro to SQL UPDATE and DELETE, and more

CIS Slightly-different version of Week 10 Lab, also intro to SQL UPDATE and DELETE, and more CIS 315 - Week 10 Lab Exercise p. 1 Sources: CIS 315 - Slightly-different version of Week 10 Lab, 10-27-09 more SELECT operations: UNION, INTERSECT, and MINUS, also intro to SQL UPDATE and DELETE, and

More information

From theory to practice. Designing Tables for a postgresql Database System. psql. Reminder. A few useful commands

From theory to practice. Designing Tables for a postgresql Database System. psql. Reminder. A few useful commands From theory to practice Designing Tables for a postgresql Database System The Entity- Relationship model: a convenient way of representing the world. The Relational model: a model for organizing data using

More information

Oracle Exam 1z0-882 Oracle Certified Professional, MySQL 5.6 Developer Version: 7.0 [ Total Questions: 100 ]

Oracle Exam 1z0-882 Oracle Certified Professional, MySQL 5.6 Developer Version: 7.0 [ Total Questions: 100 ] s@lm@n Oracle Exam 1z0-882 Oracle Certified Professional, MySQL 5.6 Developer Version: 7.0 [ Total Questions: 100 ] Oracle 1z0-882 : Practice Test Question No : 1 Consider the statements: Mysql> drop function

More information

DUE: 9. Create a query that will return the average order total for all Global Fast Foods orders from January 1, 2002, to December 21, 2002.

DUE: 9. Create a query that will return the average order total for all Global Fast Foods orders from January 1, 2002, to December 21, 2002. CIS 207 Oracle - Database Programming and SQL HOMEWORK: # 10 DUE: Run the following queries in Oracle Application Express. Paste a copy of each query Into this word document below the questions or notepad.txt

More information

Appendix A Practices and Solutions

Appendix A Practices and Solutions Appendix A Practices and Solutions Table of Contents Practices and Solutions for Lesson I... 3 Practice I-1: Accessing SQL Developer Resources... 4 Practice I-2: Using SQL Developer... 5 Practice Solutions

More information

CSC 453 Database Technologies. Tanu Malik DePaul University

CSC 453 Database Technologies. Tanu Malik DePaul University CSC 453 Database Technologies Tanu Malik DePaul University A Data Model A notation for describing data or information. Consists of mostly 3 parts: Structure of the data Data structures and relationships

More information

Assignment Grading Rubric

Assignment Grading Rubric Final Project Outcomes addressed in this activity: Overview and Directions: 1. Create a new Empty Database called Final 2. CREATE TABLES The create table statements should work without errors, have the

More information

SQL Fundamentals. Chapter 3. Class 03: SQL Fundamentals 1

SQL Fundamentals. Chapter 3. Class 03: SQL Fundamentals 1 SQL Fundamentals Chapter 3 Class 03: SQL Fundamentals 1 Class 03: SQL Fundamentals 2 SQL SQL (Structured Query Language): A language that is used in relational databases to build and query tables. Earlier

More information

Database Programming - Section 16. Instructor Guide

Database Programming - Section 16. Instructor Guide Database Programming - Section 16 Instructor Guide Table of Contents...1 Lesson 1 - Final Exam Preparation...1 What Will I Learn?...2 Why Learn It?...3 Tell Me / Show Me...4 Try It / Solve It...5 Lesson

More information

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. # 5 Structured Query Language Hello and greetings. In the ongoing

More information

1) Introduction to SQL

1) Introduction to SQL 1) Introduction to SQL a) Database language enables users to: i) Create the database and relation structure; ii) Perform insertion, modification and deletion of data from the relationship; and iii) Perform

More information

5 Integrity Constraints and Triggers

5 Integrity Constraints and Triggers 5 Integrity Constraints and Triggers 5.1 Integrity Constraints In Section 1 we have discussed three types of integrity constraints: not null constraints, primary keys, and unique constraints. In this section

More information

Instructor: Craig Duckett. Lecture 04: Thursday, April 5, Relationships

Instructor: Craig Duckett. Lecture 04: Thursday, April 5, Relationships Instructor: Craig Duckett Lecture 04: Thursday, April 5, 2018 Relationships 1 Assignment 1 is due NEXT LECTURE 5, Tuesday, April 10 th in StudentTracker by MIDNIGHT MID-TERM EXAM is LECTURE 10, Tuesday,

More information

EE221 Databases Practicals Manual

EE221 Databases Practicals Manual EE221 Databases Practicals Manual Lab 1 An Introduction to SQL Lab 2 Database Creation and Querying using SQL Assignment Data Analysis, Database Design, Implementation and Relation Normalisation School

More information

Objectives. After completing this lesson, you should be able to do the following:

Objectives. After completing this lesson, you should be able to do the following: Objectives After completing this lesson, you should be able to do the following: Describe the types of problems that subqueries can solve Define subqueries List the types of subqueries Write single-row

More information

Oracle Create Table Foreign Key On Delete No

Oracle Create Table Foreign Key On Delete No Oracle Create Table Foreign Key On Delete No Action Can I create a foreign key against only part of a composite primary key? For example, if you delete a row from the ProductSubcategory table, it could

More information

INDEX. 1 Basic SQL Statements. 2 Restricting and Sorting Data. 3 Single Row Functions. 4 Displaying data from multiple tables

INDEX. 1 Basic SQL Statements. 2 Restricting and Sorting Data. 3 Single Row Functions. 4 Displaying data from multiple tables INDEX Exercise No Title 1 Basic SQL Statements 2 Restricting and Sorting Data 3 Single Row Functions 4 Displaying data from multiple tables 5 Creating and Managing Tables 6 Including Constraints 7 Manipulating

More information

Database Design - Section 18. Instructor Guide

Database Design - Section 18. Instructor Guide Instructor Guide Table of Contents...1 Lesson 1 - Logical Comparisons and Precedence Rules...1 What Will I Learn?...2 Why Learn It?...3 Tell Me / Show Me...4 Try It / Solve It...11 Lesson 2 - Sorting

More information

Downloaded from

Downloaded from Lesson 16: Table and Integrity Constraints Integrity Constraints are the rules that a database must follow at all times. Various Integrity constraints are as follows:- 1. Not Null: It ensures that we cannot

More information

Teach Yourself InterBase

Teach Yourself InterBase Teach Yourself InterBase This tutorial takes you step-by-step through the process of creating and using a database using the InterBase Windows ISQL dialog. You learn to create data structures that enforce

More information

Database Programming with SQL

Database Programming with SQL Database Programming with SQL 12-2 Objectives In this lesson, you will learn to: Construct and execute an UPDATE statement Construct and execute a DELETE statement Construct and execute a query that uses

More information

ORACLE 12C NEW FEATURE. A Resource Guide NOV 1, 2016 TECHGOEASY.COM

ORACLE 12C NEW FEATURE. A Resource Guide NOV 1, 2016 TECHGOEASY.COM ORACLE 12C NEW FEATURE A Resource Guide NOV 1, 2016 TECHGOEASY.COM 1 Oracle 12c New Feature MULTITENANT ARCHITECTURE AND PLUGGABLE DATABASE Why Multitenant Architecture introduced with 12c? Many Oracle

More information

Creating SQL Tables and using Data Types

Creating SQL Tables and using Data Types Creating SQL Tables and using Data Types Aims: To learn how to create tables in Oracle SQL, and how to use Oracle SQL data types in the creation of these tables. Outline of Session: Given a simple database

More information