Normal Form vs. Non-First Normal Form

Size: px
Start display at page:

Download "Normal Form vs. Non-First Normal Form"

Transcription

1 Normal Form vs. Non-First Normal Form Kristian Torp Department of Computer Science Aalborg Univeristy torp September 1, 2009 daisy.aau.dk Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

2 Outline 1 Introduction 2 Creating Nested Tables Constraints Indexing 3 Modifications Insert Update Delete 4 Querying Introduction Simple Queries Unnesting Empty and Member Keywords Summary 5 Summary Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

3 Outline 1 Introduction 2 Creating Nested Tables Constraints Indexing 3 Modifications Insert Update Delete 4 Querying Introduction Simple Queries Unnesting Empty and Member Keywords Summary 5 Summary Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

4 University ER-Diagram 7 tables flat student, student , takes, course, courseprerequest, lecture, exercise 3 tables nested student, takes, course Taking it to the extreme to explore consequences Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

5 The Student Table I Create a type for the composite attribute address create or replace type address t as o b j e c t ( s t r e e t varchar2 (255), num varchar2 (255), z i p i n t e g e r, c i t y varchar2 ( ) ) ; Create a type for the multivalued attribute create type e m a i l t as t a b l e of varchar2 ( ) ; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

6 The Student Table II Create the nested table using the new types create t a b l e student ( ssn varchar2 (255) c o n s t r a i n t student pk primary key, student name varchar2 ( 255) not n u l l, address address t not n u l l, e m a i l t ) nested t a b l e s t o r e as s t u d e n t e m a i l n t ; Note The nested table is stored in a separted table names student nt Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

7 Query Nested Tables Find the students that live on Elm streeet s e l e c t from student s where s. address. s t r e e t = Elm Note Use the composite attribute The correlation name s is required The dot notation s.address.street Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

8 Query Nested Tables, cont. Find where is listed as an address s e l e c t from student where ann@nice. org member o f student. Note Use the multivalued attribute The new keyword member The dot notation cannot be used (more addresses) Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

9 Motivation Supported by Oracle in more than 10 years, little used Background knowledge to understand Oracle s technology, e.g., Spatial Data mining Semantic web Fewer tables (simpler schema) Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

10 Covered in This Lecture Looks at Creating Modifying Querying Single nested Multiple levels of nesting Table() function Value() function Do not look at Advanced OO features Reference types (REF/DEREF) Physical design (a little) VARRAY vs. nested tables Metadata views Implementation details Multiset operations All examples are Oracle specific Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

11 Terminology Concept Nested column Flat table Nested table Unnest Object table Row object Column object Description A non-atomic column A table with only atomic columns A table with one or more nested columns Convert a nested table to a flat table with same content Table where each row corresponds to an object When a row corresponds to an object A column of an object type in a table with other columns Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

12 Outline 1 Introduction 2 Creating Nested Tables Constraints Indexing 3 Modifications Insert Update Delete 4 Querying Introduction Simple Queries Unnesting Empty and Member Keywords Summary 5 Summary Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

13 A More Complicated Nested Table coursename ects prerequest lectures Alg 5 null C 5 null Alg OOP 5 C DBS 5 OOP Introduction Abstract Data Types Searching Graphs NP and NP Complete C1.1 1 The C Language C2.1 C2.4 C3.1 2 Control Structures C Functions and Parameters 6.1 C7.1 4 The Joy of Pointers C8.1 OO Stuff 1 Introduction to OOP On with the OO Stuff Class Classes and Objects Class 4.2 Inheritance Inheritance Inheritance 2.2 DBMS in Colors 1 Introduction to DBMSs DBMS in More Colors Class 2.2 Class ER Modeling Class 2.6 Class Query Languages including SQL Concurrency Control 4.4 Recov Recovery Recov 2.1 Recov 3.1 Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

14 Create The Types create or replace type s t r i n g t as t a b l e of varchar2 ( ) ; This is a collection type Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

15 Create The Types create or replace type s t r i n g t as t a b l e of varchar2 ( ) ; This is a collection type create or replace type l e c t u r e t as o b j e c t ( num i n t, s u b j e c t varchar2 (255), exercises s t r i n g t ) ; This is an object type Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

16 Create The Types create or replace type s t r i n g t as t a b l e of varchar2 ( ) ; This is a collection type create or replace type l e c t u r e t as o b j e c t ( num i n t, s u b j e c t varchar2 (255), exercises s t r i n g t ) ; This is an object type Create the lecture serie type create or replace type l e c t u r e s e r i e t as t a b l e of l e c t u r e t ; Is this a collection type or and object type? Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

17 Create The Types create or replace type s t r i n g t as t a b l e of varchar2 ( ) ; This is a collection type create or replace type l e c t u r e t as o b j e c t ( num i n t, s u b j e c t varchar2 (255), exercises s t r i n g t ) ; This is an object type Create the lecture serie type create or replace type l e c t u r e s e r i e t as t a b l e of l e c t u r e t ; Is this a collection type or and object type? Collection! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

18 Create the Table create t a b l e course ( course name varchar2 (255) c o n s t r a i n t course pk primary key, ects i n t e g e r check ( ects > 0 ), prerequests s t r i n g t, l e c t u r e s l e c t u r e s e r i e t ) nested t a b l e prerequests s t o r e as c o u r s e p r e r e q u e s t s n t nested t a b l e l e c t u r e s s t o r e as c o u r s e l e c t u r e s n t ( nested t a b l e exercises s t o r e as c o u r s e l e c t u r e e x e r c i s e n t ) ; Have two nested columns The column prerequest is nested one level The column lectures is nested two levels Note the store as clauses Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

19 Outline 1 Introduction 2 Creating Nested Tables Constraints Indexing 3 Modifications Insert Update Delete 4 Querying Introduction Simple Queries Unnesting Empty and Member Keywords Summary 5 Summary Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

20 On Types vs. On Tables Overall Design Constraints and defaults are not supported in type specifications Constraints and defaults are supported in create table statements Example The not null is not allowed in the following create or replace type a d d r e s s t n o t a l l o w e d as o b j e c t ( s t r e e t varchar2 (255) not n u l l, not allowed num varchar2 ( 255) not n u l l, not allowed z i p i n t e g e r not n u l l, not allowed c i t y varchar2 (255) not n u l l ) ; not allowed It will be shown in the following how support constraints when creating the tables Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

21 Not Null on Nested Object Column create t a b l e student ( ssn varchar2 (255) c o n s t r a i n t student pk primary key, student name varchar2 ( 255) not n u l l, address address t not n u l l, e m a i l t ) nested t a b l e s t o r e as s t u d e n t e m a i l n t ; Make sure the street name is not null, note a level lower than above a l t e r t a b l e student add c o n s t r a i n t s t u d e n t a d d r e s s s t r e e t n n check ( address. s t r e e t i s not n u l l ) ; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

22 Not Null on Collection Type Column create t a b l e c o u r s e n o t n u l l ( course name varchar2 (255) c o n s t r a i n t course nn pk primary key, ects i n t e g e r check ( ects > 0 ), prerequests s t r i n g t not n u l l, l e c t u r e s l e c t u r e s e r i e t not n u l l ) nested t a b l e prerequests s t o r e as course nn prerequests nt nested t a b l e l e c t u r e s s t o r e as c o u r s e n n l e c t u r e s n t ( nested t a b l e exercises s t o r e as c o u r s e n n l e c t u r e e x e r c i s e n t ) ; Results in an ORA Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

23 Not Null on Collection Type Column create t a b l e c o u r s e n o t n u l l ( course name varchar2 (255) c o n s t r a i n t course nn pk primary key, ects i n t e g e r check ( ects > 0 ), prerequests s t r i n g t not n u l l, l e c t u r e s l e c t u r e s e r i e t not n u l l ) nested t a b l e prerequests s t o r e as course nn prerequests nt nested t a b l e l e c t u r e s s t o r e as c o u r s e n n l e c t u r e s n t ( nested t a b l e exercises s t o r e as c o u r s e n n l e c t u r e e x e r c i s e n t ) ; Results in an ORA Must be do at the type level instead, e.g., create or replace type s t r i n g n o t n u l l t as t a b l e of varchar2 (255) not n u l l ; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

24 Primary and Unique Keys on Nested Object Columns create t a b l e student ( ssn varchar2 (255) c o n s t r a i n t student pk primary key, student name varchar2 ( 255) not n u l l, address address t not n u l l, e m a i l t ) nested t a b l e s t o r e as s t u d e n t e m a i l n t ; Make sure that no student live on the same street and number a l t e r t a b l e student add c o n s t r a i n t student address uk unique ( address. s t r e e t, address.num ) ; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

25 Primary and Unique Keys on Nested Object Columns create t a b l e student ( ssn varchar2 (255) c o n s t r a i n t student pk primary key, student name varchar2 ( 255) not n u l l, address address t not n u l l, e m a i l t ) nested t a b l e s t o r e as s t u d e n t e m a i l n t ; Make sure that no student live on the same street and number a l t e r t a b l e student add c o n s t r a i n t student address uk unique ( address. s t r e e t, address.num ) ; Primary keys are supported in a similar fashion Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

26 Primary and Unique Keys on Collection Type Columns A nested column that is a collection cannot be part of a primary key A nested column cannot be part of a unique key Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

27 Foreign Keys and Nested Columns I The prerequests must be known courses The idea in a relational context a l t e r t a b l e c o u r s e p r e r e q u e s t s n t add c o n s t r a i n t course course fk f o r e i g n key ( column value ) references course ( course name ) ; However, this does not work: A nested column cannot be used in a foreign key a l t e r t a b l e c o u r s e p r e r e q u e s t s n t add c o n s t r a i n t course course fk check ( column value i n ( s e l e c t course name from course ) ) ; Not allowed either Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

28 Foreign Keys and Nested Columns II Must do manual checking, the following must return zero s e l e c t count ( ) from ( s e l e c t cs. column value as course prere from course c, t a b l e ( c. prerequests ) cs minus s e l e c t course name from course ) ) ; Bad It is extremely ugly, and cannot be forgiven, that values in collections cannot be used in foreign key constraints! Fix this Oracle! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

29 Summary: Constraints Very weak support of constraint on collection type columns Good support of constraints on object type columns Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

30 Outline 1 Introduction 2 Creating Nested Tables Constraints Indexing 3 Modifications Insert Update Delete 4 Querying Introduction Simple Queries Unnesting Empty and Member Keywords Summary 5 Summary Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

31 Non-Unique Indexes on a Nested Column create t a b l e student ( ssn varchar2 (255) c o n s t r a i n t student pk primary key, student name varchar2 ( 255) not n u l l, address address t not n u l l, e m a i l t ) nested t a b l e s t o r e as s t u d e n t e m a i l n t ; Create an index on an object type create index s t u d e n t a d d r e s s z i p i d x on student ( address. z i p ) ; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

32 Non-Unique Indexes on a Nested Column create t a b l e student ( ssn varchar2 (255) c o n s t r a i n t student pk primary key, student name varchar2 ( 255) not n u l l, address address t not n u l l, e m a i l t ) nested t a b l e s t o r e as s t u d e n t e m a i l n t ; Create an index on an object type create index s t u d e n t a d d r e s s z i p i d x on student ( address. z i p ) ; Create an index on a collection type create index s t u d e n t e m a i l i d x on s t u d e n t e m a i l n t ( column value ) ; Note this special value column value Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

33 An Index on a Multi-Level Nested Column create t a b l e course ( course name varchar2 (255) c o n s t r a i n t course pk primary key, ects i n t e g e r check ( ects > 0 ), prerequests s t r i n g t, l e c t u r e s l e c t u r e s e r i e t ) nested t a b l e prerequests s t o r e as c o u r s e p r e r e q u e sts n t nested t a b l e l e c t u r e s s t o r e as c o u r s e l e c t u r e s n t ( nested t a b l e exercises s t o r e as c o u r s e l e c t u r e e x e r c i s e n t ) ; Create an index on the lecture subjects Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

34 An Index on a Multi-Level Nested Column create t a b l e course ( course name varchar2 (255) c o n s t r a i n t course pk primary key, ects i n t e g e r check ( ects > 0 ), prerequests s t r i n g t, l e c t u r e s l e c t u r e s e r i e t ) nested t a b l e prerequests s t o r e as c o u r s e p r e r e q u e sts n t nested t a b l e l e c t u r e s s t o r e as c o u r s e l e c t u r e s n t ( nested t a b l e exercises s t o r e as c o u r s e l e c t u r e e x e r c i s e n t ) ; Create an index on the lecture subjects create index c o u r s e l e c t u r e s u b j e c t i d x on c o u r s e l e c t u r e s n t ( s u b j e c t ) ; Must know that subject is a column in the nested table The name of the nested table is needed, otherwise like other indexes Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

35 Unique Indexes on a Nested Column Create an unique index create unique index s t u d e n t e m a i l i d x on s t u d e n t e m a i l n t ( column value ) ; Insert with an existing address i n s e r t i n t o student values (606, Fred, address t ( Pie, 32, 9000, Aalborg ), e m a i l t ( curt@cs. com ) ) ; Results in an integrity constraint violation Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

36 Quiz: Unique Indexes on a Nested Column Will this insert statement with unique index on column value work? i n s e r t i n t o student values (606, Fred, address t ( Pie, 32, 9000, Aalborg ), e m a i l t ( fred@nice. org, ann@nice. org ) ) ; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

37 Quiz: Unique Indexes on a Nested Column Will this insert statement with unique index on column value work? i n s e r t i n t o student values (606, Fred, address t ( Pie, 32, 9000, Aalborg ), e m a i l t ( fred@nice. org, ann@nice. org ) ) ; No the uniqueness is specified at the column value! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

38 Quiz: Unique Indexes on a Nested Column Will this insert statement with unique index on column value work? i n s e r t i n t o student values (606, Fred, address t ( Pie, 32, 9000, Aalborg ), e m a i l t ( fred@nice. org, ann@nice. org ) ) ; No the uniqueness is specified at the column value! Will this insert statement work? i n s e r t i n t o student values (606, Fred, address t ( Pie, 32, 9000, Aalborg ), e m a i l t ( fred@nice. org ) ) ; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

39 Quiz: Unique Indexes on a Nested Column Will this insert statement with unique index on column value work? i n s e r t i n t o student values (606, Fred, address t ( Pie, 32, 9000, Aalborg ), e m a i l t ( fred@nice. org, ann@nice. org ) ) ; No the uniqueness is specified at the column value! Will this insert statement work? i n s e r t i n t o student values (606, Fred, address t ( Pie, 32, 9000, Aalborg ), e m a i l t ( fred@nice. org ) ) ; Yes! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

40 Summary: Creating Nested Table Collection type vs. object type The special value column value Good support for primary key and unique key on nested columns No support for foreign keys on nested columns This is clearly a missing feature Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

41 Summary: Creating Nested Table Collection type vs. object type The special value column value Good support for primary key and unique key on nested columns No support for foreign keys on nested columns This is clearly a missing feature Recommendations Composite attribute from ERD can quite naturally be used in NFNF Multivalue attributes are well-suited for using with NFNF Be careful nesting more than two levels Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

42 Outline 1 Introduction 2 Creating Nested Tables Constraints Indexing 3 Modifications Insert Update Delete 4 Querying Introduction Simple Queries Unnesting Empty and Member Keywords Summary 5 Summary Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

43 Introduction Rules of Thumb At the outer-table level insert, update, and delete syntax is as in plain SQL At the inner-table level the syntax has changed Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

44 Outline 1 Introduction 2 Creating Nested Tables Constraints Indexing 3 Modifications Insert Update Delete 4 Querying Introduction Simple Queries Unnesting Empty and Member Keywords Summary 5 Summary Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

45 Insert i n s e r t i n t o student values ( 102, Pete, address t ( Pie, 31, 9000, Aalborg ), e m a i l t ( pete@verynice. org, pete@example. com ) ) ; i n s e r t i n t o student values ( 101, Curt, address t ( Elm, 11, 8000, Aarhus ), e m a i l t ( curt@cs. com ) ) ; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

46 Insert i n s e r t i n t o student values ( 102, Pete, address t ( Pie, 31, 9000, Aalborg ), e m a i l t ( pete@verynice. org, pete@example. com ) ) ; i n s e r t i n t o student values ( 101, Curt, address t ( Elm, 11, 8000, Aarhus ), e m a i l t ( curt@cs. com ) ) ; Even if only a single row in the nested column t must be used Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

47 Insert with Null I i n s e r t i n t o student values ( 303, Nick, address t ( Sun, 21, 9000, Aalborg ), n u l l ) ; 303 Nick Sun Aalborg null The address cannot be a null value, decleared as not null Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

48 Insert with Null II i n s e r t i n t o student values (707, Jim, n u l l, n u l l ) Disallowed because address is declared not null i n s e r t i n t o student s values (707, Jim, address t ( n u l l, n u l l, n u l l, n u l l ), n u l l ) Disallowed, because address.street is declared not null i n s e r t i n t o student s values (707, Jim, address t ( Boulevarden, n u l l, n u l l, n u l l ), n u l l ) Allowed, minimal set of information provided Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

49 Insert with Column Using Column Names i n s e r t i n t o student ( ssn, student name, address ) values (606, Jim, address t ( Boulevarden, 20, 9000, Aalborg ) ) Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

50 Insert with Column Using Column Names i n s e r t i n t o student ( ssn, student name, address ) values (606, Jim, address t ( Boulevarden, 20, 9000, Aalborg ) ) This is the same i n s e r t i n t o student s ( ssn, student name, s. address ) values (606, Jim, address t ( Boulevarden, 20, 9000, Aalborg ) ) Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

51 Insert with Column Using Column Names i n s e r t i n t o student ( ssn, student name, address ) values (606, Jim, address t ( Boulevarden, 20, 9000, Aalborg ) ) This is the same i n s e r t i n t o student s ( ssn, student name, s. address ) values (606, Jim, address t ( Boulevarden, 20, 9000, Aalborg ) ) Weird correlation name is optional when inserting Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

52 Illegale Inserts i n s e r t i n t o student s ( ssn, student name, s. address. s t r e e t, s. address. num, s. address. zip, s. address. c i t y ) values (606, Jim, Boulevarden, 20, 9000, Aalborg ) Does not work: only simple column names are allowed, not that logical Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

53 Illegale Inserts i n s e r t i n t o student s ( ssn, student name, s. address. s t r e e t, s. address. num, s. address. zip, s. address. c i t y ) values (606, Jim, Boulevarden, 20, 9000, Aalborg ) Does not work: only simple column names are allowed, not that logical i n s e r t i n t o student values (606, Jim, Boulevarden, 20, 9000, Aalborg ) Too many values, this is quite logical! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

54 Insert Empty Collection i n s e r t i n t o student values ( 404, E r i c, address t ( Blv, 29, 9000, Aalborg ), e m a i l t ( ) ) ; 303 Nick Sun Aalborg null 404 Eric Blv Aalborg <empty> Note the empty cell value The is called a literal invocation of the type constructor. Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

55 Insert Collection 303 Nick Sun Aalborg null 404 Eric Blv Aalborg <empty> Giv Eric an address update student set = e m a i l t ( eric@nice. org ) where ssn = 404; 303 Nick Sun Aalborg null 404 Eric Blv Aalborg eric@nice.org Updates the entire collection column Multiple addresses can be provided Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

56 Insert Collection, Alternative 303 Nick Sun Aalborg null 404 Eric Blv Aalborg <empty> i n s e r t i n t o t a b l e ( s e l e c t s. from student s where s. ssn = 404) values ( eric@nice. org ) ; 303 Nick Sun Aalborg null 404 Eric Blv Aalborg eric@nice.org This insert is actually an update! Only a single address can be provided Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

57 Insert Multi-Level Collection coursename ects prerequest lectures Alg 5 null 1 Introduction 2 Abstract Data Types 3 Searching 4 Graphs 5 NP and NP Complete i n s e r t i n t o course values ( Alg, 5, n u l l, l e c t u r e s e r i e t ( l e c t u r e t ( 1, I n t r o d u c t i o n, s t r i n g t ( 1.1, 1.3, 1.5 ) ), l e c t u r e t ( 2, A b s tract Data Types, s t r i n g t ( 2.2, 2.4 ) ), l e c t u r e t ( 3, Searching, s t r i n g t ( 3.2, 3.6, 3.8 ) ), l e c t u r e t ( 4, Graphs, s t r i n g t ( 4.1, 4.2 ) ), l e c t u r e t ( 5, NP and NP Complete, s t r i n g t ( 4.1, 5.2, 5.4 ) ) ) ) ; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

58 Outline 1 Introduction 2 Creating Nested Tables Constraints Indexing 3 Modifications Insert Update Delete 4 Querying Introduction Simple Queries Unnesting Empty and Member Keywords Summary 5 Summary Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

59 Update Part of a Nested Column Ann lives on Sun Boulevard not Elm Street update student s set s. address. s t r e e t = Sun where ssn = 202; Note the correlation name is required, i.e., both below are wrong update student wrong set address. s t r e e t = Sun where ssn = 202; update student wrong set student. address. s t r e e t = Sun where ssn = 202; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

60 Update Entire Nested Column Move Pete to Aarhus update student set address = address t ( Elm, 13, 8000, Aarhus ) where ssn = 102; Looks like plain SQL update Note the use of the constructor Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

61 Update a Collection using Table Syntax 303 Nick Sun Aalborg null 404 Eric Blv Aalborg <empty> Changes Curt s cs address to a.edu domain update t a b l e ( s e l e c t s. from student s where s. ssn = 404) s t set value ( s t ) = curt@cs. edu where value ( s t ) = curt@cs. com Restriction on the Query Must return a single collection Select list must contain this single collection Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

62 Quiz: Update a Collection using Table Syntax Changes Ann s nice.org address to a.cs.org domain update t a b l e ( s e l e c t s. from student s where s. ssn = 202) x set value ( x ) = ann@cs. org Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

63 Quiz: Update a Collection using Table Syntax Changes Ann s nice.org address to a.cs.org domain update t a b l e ( s e l e c t s. from student s where s. ssn = 202) x set value ( x ) = ann@cs. org ann@cs.org ann@cs.org Both rows are updated! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

64 Quiz: Update a Collection using Table Syntax, Again update t a b l e ( s e l e c t s. from student s where s. ssn = 202) x set value ( x ) = ann@cs. org where value ( x ) = ann@nice. org Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

65 Quiz: Update a Collection using Table Syntax, Again update t a b l e ( s e l e c t s. from student s where s. ssn = 202) x set value ( x ) = ann@cs. org where value ( x ) = ann@nice. org Alternative notation is update t a b l e ( s e l e c t s. from student s where s. ssn = 202) set column value = ann@cs. org where column value = ann@nice. org Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

66 Quiz: Update a Collection using Table Syntax, Again update t a b l e ( s e l e c t s. from student s where s. ssn = 202) x set value ( x ) = ann@cs. org where value ( x ) = ann@nice. org Alternative notation is update t a b l e ( s e l e c t s. from student s where s. ssn = 202) set column value = ann@cs. org where column value = ann@nice. org ann@cs.org This is the result wanted! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

67 Update a Part of Multiple Collections I ann@cs.org Update all domains to pete@nice.org Assume that addresses are not unique! update t a b l e ( s e l e c t s. from student s ) set column value = pete@nice. org where column value = pete@example. com Gives an ORA error, more than one collection in table() Cannot be done in SQL must be done in PL/SQL Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

68 Update a Part of Multiple Collections II create or replace procedure update student ( from value i n varchar2, t o v a l u e i n varchar2 ) i s type t s n n t a b i s t a b l e of student. ssn%type ; v t s n n t a b ; begin s e l e c t s. ssn bulk c o l l e c t i n t o v from student s where from value member o f s. ; f o r a l l i i n v. f i r s t.. v. l a s t update t a b l e ( s e l e c t s. from student s where s. ssn = v ( i ) set column value = t o v a l u e where column value = from value ; end ; Find all outer rows to update Update the collections of s for each outer row Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

69 Update a Part of Multiple Collections III ann@cs.org execute update student ( pete@example. com, pete@nice. org ) ; ann@cs.org pete@nice.org pete@nice.org Note Procedural need because table function can use only one collection Ugly Oracle, fix this! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

70 Update a Collection using Constructor 303 Nick Sun Aalborg null 404 Eric Blv Aalborg <empty> Give Eric an address update student set = e m a i l t ( eric@nice. org ) where ssn = 303; 303 Nick Sun Aalborg null 404 Eric Blv Aalborg eric@nice.org More than one address allowed in constructor! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

71 Updating a Multiple-Level Nested Column coursename ects prerequest lectures 1 Introduction 2 Abstract Data Types Alg 5 null 3 Searching 4 Graphs 5 NP and NP Complete Course number 2 should be number 7 instead update t a b l e ( s e l e c t l e c t u r e s from course where course name = Alg ) s t set s t. no = 7 where s t. no = 2; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

72 Updating a Multiple-Level Nested Column, cont. coursename ects prerequest lectures 1 Introduction 2 Abstract Data Types Alg 5 null 3 Searching 4 Graphs 5 NP and NP Complete The first exercise for the third lecture should be 3.3 and not 3.2 update t a b l e ( s e l e c t l. exercises from course, t a b l e ( l e c t u r e s ) l where course name = Alg and l. no = 3) e set value ( e ) = 3.3 where value ( e ) = 3.2 Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

73 Outline 1 Introduction 2 Creating Nested Tables Constraints Indexing 3 Modifications Insert Update Delete 4 Querying Introduction Simple Queries Unnesting Empty and Member Keywords Summary 5 Summary Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

74 Delete Entire Rows 303 Nick Sun Aalborg null 404 Eric Blv Aalborg Delete Eric and Nick d e l e te from student where ssn = 404 or ssn = 303; Plain old SQL delete syntax! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

75 Delete Entire Rows Based on Nested Column Delete the students that live in Aalborg d e l e te from student s where s. address. c i t y = Aalborg As before the correlation name is needed! Straight-forward compared to plain SQL Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

76 Delete Entire Rows Based on Collection I Delete student that have the address d e l e te from student where ann@nice. org member o f student. This is quite straight forward! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

77 Delete Entire Rows Based on Collection II Delete students that have an address like example.com Find the rows that have the address like example.com s e l e c t from student s, t a b l e ( s. ) x l where x l. column value l i k e %example. com ; However, more than one table is involved, therefore the following is illegale d e l e te from student s, t a b l e ( s. ) x l where x l. column value l i k e %example. com ; This is not logical at the conceptual level! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

78 Delete Entire Rows Based on Collection III Delete students that have an address like example.com d e l e te from student s where 1 = ( s e l e c t 1 from t a b l e ( s. ) x l where x l. column value l i k e %example. com ) Note that only one row is returned for each outer row! Sorry, could not find nicer formulation Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

79 Delete Single Value from a Collection Deletes Ann s address at nice.org (but not the other addresses) d e l e te from t a b l e ( s e l e c t s. from student s where s. ssn = 202) s t where value ( s t ) = ann@nice. org Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

80 Delete a Single Value from a Number of Collections I Deletes.com addresses d e l e te from t a b l e ( s e l e c t s. from student s ) s t where value ( s t ) l i k e %.com Results in ORA error Cannot be done in SQL must be done in PL/SQL Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

81 Delete a Single Value from a Number of Collections II create or replace procedure d e l e t e s t u d e n t e m a i l l i k e ( p a t t e r n i n varchar2 ) i s type t s n n t a b i s t a b l e of student. ssn%type ; v t s n n t a b ; begin s e l e c t d i s t i n c t s. ssn bulk c o l l e c t i n t o v from student s, t a b l e ( s. ) where column value l i k e p a t t e r n ; end ; / f o r a l l i i n v. f i r s t.. v. l a s t delete from t a b l e ( s e l e c t s. from student s where s. ssn = v ( i ) ) where column value l i k e p a t t e r n ; Find the outer rows where collection must be modified Modify the collection for each outer row Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

82 Delete a Single Value from a Number of Collections III execute d e l e t e s t u d e n t e m a i l l i k e ( %.com ) ; ann@cs.org 101 Curt Elm Aarhus <empty> The Curt tuple has an empty set of s Recall { } Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

83 Delete All Values from a Collection coursename ects prerequest lectures OOP 5 Alg C 1 Introduction to OOP 2 Classes and Objects 3 Inheritance OO Stuff On with the OO Stuff Class 2.2 Class 4.2 Inheritance 1.1 Inheritance 2.2 Remove all prerequest for the OOP course update course set prerequests = n u l l where course name = OOP Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

84 Delete All Values from a Collection coursename ects prerequest lectures OOP 5 Alg C 1 Introduction to OOP 2 Classes and Objects 3 Inheritance OO Stuff On with the OO Stuff Class 2.2 Class 4.2 Inheritance 1.1 Inheritance 2.2 Remove all prerequest for the OOP course update course set prerequests = n u l l where course name = OOP coursename ects prerequest lectures 1 Introduction to OOP OOP 5 null 2 Classes and Objects 3 Inheritance OO Stuff On with the OO Stuff Class 2.2 Class 4.2 Inheritance 1.1 Inheritance 2.2 Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

85 Delete Some Values from a Collection coursename ects prerequest lectures 1 Introduction to OOP OOP 5 null 2 Classes and Objects 3 Inheritance OO Stuff On with the OO Stuff Class 2.2 Class 4.2 Inheritance 1.1 Inheritance 2.2 Remove the first and third lecture d e l e te from t a b l e ( s e l e c t l e c t u r e s from course where course name = OOP ) s t where value ( s t ) = l e c t u r e t ( 1, I n t r o d u c t i o n to OOP, s t r i n g t ( OO S t u f f, On with the OO S t u f f ) ) ; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

86 Delete Some Values from a Collection coursename ects prerequest lectures 1 Introduction to OOP OOP 5 null 2 Classes and Objects 3 Inheritance OO Stuff On with the OO Stuff Class 2.2 Class 4.2 Inheritance 1.1 Inheritance 2.2 Remove the first and third lecture d e l e te from t a b l e ( s e l e c t l e c t u r e s from course where course name = OOP ) s t where value ( s t ) = l e c t u r e t ( 1, I n t r o d u c t i o n to OOP, s t r i n g t ( OO S t u f f, On with the OO S t u f f ) ) ; coursename ects prerequest lectures 2 Classes and Objects OOP 5 null 3 Inheritance Class 2.2 Class 4.2 Inheritance 1.1 Inheritance 2.2 Deletes only the first row Very long (and ugly!) Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

87 Delete Some Values from a Collection, Alternative coursename ects prerequest lectures 1 Introduction to OOP OOP 5 null 2 Classes and Objects 3 Inheritance OO Stuff On with the OO Stuff Class 2.2 Class 4.2 Inheritance 1.1 Inheritance 2.2 Remove the first and third lecture d e l e te from t a b l e ( s e l e c t l e c t u r e s from course where course name = OOP ) s t where s t. no = 1 or s t. no = 3; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

88 Delete Some Values from a Collection, Alternative coursename ects prerequest lectures 1 Introduction to OOP OOP 5 null 2 Classes and Objects 3 Inheritance OO Stuff On with the OO Stuff Class 2.2 Class 4.2 Inheritance 1.1 Inheritance 2.2 Remove the first and third lecture d e l e te from t a b l e ( s e l e c t l e c t u r e s from course where course name = OOP ) s t where s t. no = 1 or s t. no = 3; coursename ects prerequest lectures OOP 5 null 2 Classes and Objects Class 2.2 Class 4.2 Note where the dot is placed Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

89 Summary: Modifications For nested tables insert statement can become quite complicated Constructors are needed when inserting values in nested columns Default constructor is provided by the system The statements update from table() and delete from table () are new The dot notation can be used for object types, e.g., set address.zip = 9000 For collection types the syntax the value() function must be used, e.g., value(e) = 23 A correlation name is needed to access a nested column Unnesting is necessary to update a nested collection column This is covered in details in the next section Deleting single elements from a collection is quite complicated! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

90 Outline 1 Introduction 2 Creating Nested Tables Constraints Indexing 3 Modifications Insert Update Delete 4 Querying Introduction Simple Queries Unnesting Empty and Member Keywords Summary 5 Summary Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

91 Outline 1 Introduction 2 Creating Nested Tables Constraints Indexing 3 Modifications Insert Update Delete 4 Querying Introduction Simple Queries Unnesting Empty and Member Keywords Summary 5 Summary Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

92 Quiz s e l e c t count ( ) from student What result is returned (3 or 5)? Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

93 Quiz s e l e c t count ( ) from student What result is returned (3 or 5)? 3! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

94 Unnesting s e l e c t from student, table ( ) ssn student name address.street address.num address.zip address.city column value curt@cs.com This is called unnesting. Much more on this later! Note the dot names, e.g., address.zip Note that the nested column is there twice Note the special column column value Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

95 Outline 1 Introduction 2 Creating Nested Tables Constraints Indexing 3 Modifications Insert Update Delete 4 Querying Introduction Simple Queries Unnesting Empty and Member Keywords Summary 5 Summary Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

96 List all the Students s e l e c t from student Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

97 List all the Students s e l e c t from student Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

98 Access a Nested Table Directly create t a b l e student ( ssn varchar2 (255) c o n s t r a i n t student pk primary key, student name varchar2 ( 255) not n u l l, address address t not n u l l, e m a i l t ) nested t a b l e s t o r e as s t u d e n t e m a i l n t ; s e l e c t from s t u d e n t e m a i l n t Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

99 Access a Nested Table Directly create t a b l e student ( ssn varchar2 (255) c o n s t r a i n t student pk primary key, student name varchar2 ( 255) not n u l l, address address t not n u l l, e m a i l t ) nested t a b l e s t o r e as s t u d e n t e m a i l n t ; s e l e c t from s t u d e n t e m a i l n t Gets an ORA error Nested tables cannot be accessed directly Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

100 Get the Value of a Collection s e l e c t value ( e ) as from student s, t a b l e ( s. ) e where s. ssn = 202 Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

101 Get the Value of a Collection s e l e c t value ( e ) as from student s, t a b l e ( s. ) e where s. ssn = 202 Note the value keyword Note the table function Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

102 The Value Function An object reference function Takes single argument that is correlation name to a collection or an object table Returns object instances stored in the collection or object table The return type is the same type as the collection or object table Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

103 Using Constructors in the Where Clause s e l e c t from student s where s. = e m a i l t ( curt@cs. com ) Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

104 Using Constructors in the Where Clause s e l e c t from student s where s. = e m a i l t ( curt@cs. com ) Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

105 Using Constructors in the Where Clause s e l e c t from student s where s. = e m a i l t ( curt@cs. com ) s e l e c t from student s where s. = e m a i l t ( ann@nice. org ) Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

106 Using Constructors in the Where Clause s e l e c t from student s where s. = e m a i l t ( curt@cs. com ) s e l e c t from student s where s. = e m a i l t ( ann@nice. org ) Returns no rows, because Ann has two addresses Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

107 Order in Collection Types s e l e c t from student s where s. = e m a i l t ( ann@nice. org, ann@example. com ) Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

108 Order in Collection Types s e l e c t from student s where s. = e m a i l t ( ann@nice. org, ann@example. com ) s e l e c t from student s where s. = e m a i l t ( ann@example. com, ann@nice. org ) Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

109 Order in Collection Types s e l e c t from student s where s. = e m a i l t ( ann@nice. org, ann@example. com ) s e l e c t from student s where s. = e m a i l t ( ann@example. com, ann@nice. org ) Both returns one row Nice result! Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

110 The Table Expression Get the names of students with a.org address s e l e c t s. student name from student s, t a b l e ( s. ) where . column value l i k e %.org Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

111 The Table Expression Get the names of students with a.org address s e l e c t s. student name from student s, t a b l e ( s. ) where . column value l i k e %.org student name Ann Pete Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

112 The Table Expression Get the names of students with a.org address s e l e c t s. student name from student s, t a b l e ( s. ) where . column value l i k e %.org student name Ann Pete Get the maximum value of an address s e l e c t max( value ( x ) ) from student s, t a b l e ( s. ) x ; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

113 The Table Expression Get the names of students with a.org address s e l e c t s. student name from student s, t a b l e ( s. ) where . column value l i k e %.org student name Ann Pete Get the maximum value of an address s e l e c t max( value ( x ) ) from student s, t a b l e ( s. ) x ; Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

114 The Table Expression Continued States that a value is a collection, i.e., not a scalar value Returns a collection that can be queried as if it was a flat table Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

115 The Table Expression Continued States that a value is a collection, i.e., not a scalar value Returns a collection that can be queried as if it was a flat table How many rows returned by s e l e c t from student, t a b l e ( ) e1, t a b l e ( ) e2 Make simple stuff look complicated s e l e c t column value from t a b l e ( cast ( m u l t i s e t ( s e l e c t table name from cat ) as s t r i n g t ) ) Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

116 The Table Expression Continued States that a value is a collection, i.e., not a scalar value Returns a collection that can be queried as if it was a flat table How many rows returned by s e l e c t from student, t a b l e ( ) e1, t a b l e ( ) e2 Make simple stuff look complicated s e l e c t column value from t a b l e ( cast ( m u l t i s e t ( s e l e c t table name from cat ) as s t r i n g t ) ) Alternative s e l e c t table name from cat Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

117 The cardinality Keyword The the SSN of student with more than on address s e l e c t s. ssn from student s where c a r d i n a l i t y ( s. ) > 1 Find the number of addresses for each student s e l e c t s. student name, c a r d i n a l i t y ( s. ) as no addresses from student s Find the number rows in the unnested table s e l e c t sum( c a r d i n a l i t y ( s. ) ) from student s Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

118 Outline 1 Introduction 2 Creating Nested Tables Constraints Indexing 3 Modifications Insert Update Delete 4 Querying Introduction Simple Queries Unnesting Empty and Member Keywords Summary 5 Summary Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

119 From Nested to Flat s e l e c t student. ssn, student. student name, column value as from student, t a b l e ( student. ) It is necessary to list the columns Weird that implicit natural-join happens, i.e., No where clause, and No join specified in from clause Kristian Torp (Aalborg University) Normal Form vs. Non-First Normal Form September 1, / 96

Introduction to Triggers using SQL

Introduction to Triggers using SQL Introduction to Triggers using SQL Kristian Torp Department of Computer Science Aalborg University www.cs.aau.dk/ torp torp@cs.aau.dk November 24, 2011 daisy.aau.dk Kristian Torp (Aalborg University) Introduction

More information

Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification

Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Outline More Complex SQL Retrieval Queries

More information

IT2305 Database Systems I (Compulsory)

IT2305 Database Systems I (Compulsory) Database Systems I (Compulsory) INTRODUCTION This is one of the 4 modules designed for Semester 2 of Bachelor of Information Technology Degree program. CREDITS: 04 LEARNING OUTCOMES On completion of this

More information

IT2304: Database Systems 1 (DBS 1)

IT2304: Database Systems 1 (DBS 1) : Database Systems 1 (DBS 1) (Compulsory) 1. OUTLINE OF SYLLABUS Topic Minimum number of hours Introduction to DBMS 07 Relational Data Model 03 Data manipulation using Relational Algebra 06 Data manipulation

More information

CS2Bh: Current Technologies. Introduction to XML and Relational Databases. The Relational Model. The relational model

CS2Bh: Current Technologies. Introduction to XML and Relational Databases. The Relational Model. The relational model CS2Bh: Current Technologies Introduction to XML and Relational Databases Spring 2005 The Relational Model CS2 Spring 2005 (LN6) 1 The relational model Proposed by Codd in 1970. It is the dominant data

More information

Oracle SQL. Course Summary. Duration. Objectives

Oracle SQL. Course Summary. Duration. Objectives Oracle SQL Course Summary Identify the major structural components of the Oracle Database 11g Create reports of aggregated data Write SELECT statements that include queries Retrieve row and column data

More information

Oracle Database 12c: Introduction to SQL Ed 1.1

Oracle Database 12c: Introduction to SQL Ed 1.1 Oracle University Contact Us: 1.800.529.0165 Oracle Database 12c: Introduction to SQL Ed 1.1 Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training helps you write subqueries,

More information

Oracle Database: SQL and PL/SQL Fundamentals

Oracle Database: SQL and PL/SQL Fundamentals Oracle University Contact Us: 1.800.529.0165 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This course is designed to deliver the fundamentals of SQL and PL/SQL along

More information

Instant SQL Programming

Instant SQL Programming Instant SQL Programming Joe Celko Wrox Press Ltd. INSTANT Table of Contents Introduction 1 What Can SQL Do for Me? 2 Who Should Use This Book? 2 How To Use This Book 3 What You Should Know 3 Conventions

More information

Chapter 9: Object-Based Databases

Chapter 9: Object-Based Databases Chapter 9: Object-Based Databases Database System Concepts See www.db-book.com for conditions on re-use Database System Concepts Chapter 9: Object-Based Databases Complex Data Types and Object Orientation

More information

Chapter 5. SQL: Queries, Constraints, Triggers

Chapter 5. SQL: Queries, Constraints, Triggers Chapter 5 SQL: Queries, Constraints, Triggers 1 Overview: aspects of SQL DML: Data Management Language. Pose queries (Ch. 5) and insert, delete, modify rows (Ch. 3) DDL: Data Definition Language. Creation,

More information

SQL Server. 1. What is RDBMS?

SQL Server. 1. What is RDBMS? SQL Server 1. What is RDBMS? Relational Data Base Management Systems (RDBMS) are database management systems that maintain data records and indices in tables. Relationships may be created and maintained

More information

Oracle Database 10g: Introduction to SQL

Oracle Database 10g: Introduction to SQL Oracle University Contact Us: 1.800.529.0165 Oracle Database 10g: Introduction to SQL Duration: 5 Days What you will learn This course offers students an introduction to Oracle Database 10g database technology.

More information

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle Database: SQL and PL/SQL Fundamentals NEW Oracle University Contact Us: + 38516306373 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the

More information

Schema Evolution in SQL-99 and Commercial (Object-)Relational DBMS

Schema Evolution in SQL-99 and Commercial (Object-)Relational DBMS Schema Evolution in SQL-99 and Commercial (Object-)Relational DBMS Can Türker Swiss Federal Institute of Technology (ETH) Zurich Institute of Information Systems, ETH Zentrum CH 8092 Zurich, Switzerland

More information

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff D80198GC10 Oracle Database 12c SQL and Fundamentals Summary Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff Level Professional Delivery Method Instructor-led

More information

CSC 742 Database Management Systems

CSC 742 Database Management Systems CSC 742 Database Management Systems Topic #4: Data Modeling Spring 2002 CSC 742: DBMS by Dr. Peng Ning 1 Phases of Database Design Requirement Collection/Analysis Functional Requirements Functional Analysis

More information

Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases

Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Outline Informal Design Guidelines

More information

Relational Database Basics Review

Relational Database Basics Review Relational Database Basics Review IT 4153 Advanced Database J.G. Zheng Spring 2012 Overview Database approach Database system Relational model Database development 2 File Processing Approaches Based on

More information

SUBQUERIES AND VIEWS. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 6

SUBQUERIES AND VIEWS. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 6 SUBQUERIES AND VIEWS CS121: Introduction to Relational Database Systems Fall 2015 Lecture 6 String Comparisons and GROUP BY 2! Last time, introduced many advanced features of SQL, including GROUP BY! Recall:

More information

Oracle 10g PL/SQL Training

Oracle 10g PL/SQL Training Oracle 10g PL/SQL Training Course Number: ORCL PS01 Length: 3 Day(s) Certification Exam This course will help you prepare for the following exams: 1Z0 042 1Z0 043 Course Overview PL/SQL is Oracle's Procedural

More information

In This Lecture. SQL Data Definition SQL SQL. Notes. Non-Procedural Programming. Database Systems Lecture 5 Natasha Alechina

In This Lecture. SQL Data Definition SQL SQL. Notes. Non-Procedural Programming. Database Systems Lecture 5 Natasha Alechina This Lecture Database Systems Lecture 5 Natasha Alechina The language, the relational model, and E/R diagrams CREATE TABLE Columns Primary Keys Foreign Keys For more information Connolly and Begg chapter

More information

Part A: Data Definition Language (DDL) Schema and Catalog CREAT TABLE. Referential Triggered Actions. CSC 742 Database Management Systems

Part A: Data Definition Language (DDL) Schema and Catalog CREAT TABLE. Referential Triggered Actions. CSC 742 Database Management Systems CSC 74 Database Management Systems Topic #0: SQL Part A: Data Definition Language (DDL) Spring 00 CSC 74: DBMS by Dr. Peng Ning Spring 00 CSC 74: DBMS by Dr. Peng Ning Schema and Catalog Schema A collection

More information

Oracle Database: SQL and PL/SQL Fundamentals

Oracle Database: SQL and PL/SQL Fundamentals Oracle University Contact Us: +966 12 739 894 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training is designed to

More information

Functional Dependency and Normalization for Relational Databases

Functional Dependency and Normalization for Relational Databases Functional Dependency and Normalization for Relational Databases Introduction: Relational database design ultimately produces a set of relations. The implicit goals of the design activity are: information

More information

Databases and BigData

Databases and BigData Eduardo Cunha de Almeida eduardo.almeida@uni.lu Outline of the course Introduction Database Systems (E. Almeida) Distributed Hash Tables and P2P (C. Cassagnes) NewSQL (D. Kim and J. Meira) NoSQL (D. Kim)

More information

MOC 20461C: Querying Microsoft SQL Server. Course Overview

MOC 20461C: Querying Microsoft SQL Server. Course Overview MOC 20461C: Querying Microsoft SQL Server Course Overview This course provides students with the knowledge and skills to query Microsoft SQL Server. Students will learn about T-SQL querying, SQL Server

More information

Introduction to the Oracle DBMS

Introduction to the Oracle DBMS Introduction to the Oracle DBMS Kristian Torp Department of Computer Science Aalborg University www.cs.aau.dk/ torp torp@cs.aau.dk December 2, 2011 daisy.aau.dk Kristian Torp (Aalborg University) Introduction

More information

Basic Concepts of Database Systems

Basic Concepts of Database Systems CS2501 Topic 1: Basic Concepts 1.1 Basic Concepts of Database Systems Example Uses of Database Systems - account maintenance & access in banking - lending library systems - airline reservation systems

More information

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB Outline Database concepts Conceptual Design Logical Design Communicating with the RDBMS 2 Some concepts Database: an

More information

Introduction to Databases

Introduction to Databases Page 1 of 5 Introduction to Databases An introductory example What is a database? Why do we need Database Management Systems? The three levels of data abstraction What is a Database Management System?

More information

Databases and DBMS. What is a Database?

Databases and DBMS. What is a Database? Databases and DBMS Eric Lew (MSc, BSc) SeconSys Inc. Nov 2003 What is a Database? Data (singular: datum) Factual Information Database Organized body of related information Repository / storage of information

More information

How To Manage Data In A Database System

How To Manage Data In A Database System Database Systems Session 2 Main Theme Relational Data Model & Relational Database Constraints Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical

More information

Relational model. Relational model - practice. Relational Database Definitions 9/27/11. Relational model. Relational Database: Terminology

Relational model. Relational model - practice. Relational Database Definitions 9/27/11. Relational model. Relational Database: Terminology COS 597A: Principles of Database and Information Systems elational model elational model A formal (mathematical) model to represent objects (data/information), relationships between objects Constraints

More information

BCA. Database Management System

BCA. Database Management System BCA IV Sem Database Management System Multiple choice questions 1. A Database Management System (DBMS) is A. Collection of interrelated data B. Collection of programs to access data C. Collection of data

More information

Physical Design. Meeting the needs of the users is the gold standard against which we measure our success in creating a database.

Physical Design. Meeting the needs of the users is the gold standard against which we measure our success in creating a database. Physical Design Physical Database Design (Defined): Process of producing a description of the implementation of the database on secondary storage; it describes the base relations, file organizations, and

More information

The Relational Model. Ramakrishnan&Gehrke, Chapter 3 CS4320 1

The Relational Model. Ramakrishnan&Gehrke, Chapter 3 CS4320 1 The Relational Model Ramakrishnan&Gehrke, Chapter 3 CS4320 1 Why Study the Relational Model? Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. Legacy systems in older models

More information

In This Lecture. Security and Integrity. Database Security. DBMS Security Support. Privileges in SQL. Permissions and Privilege.

In This Lecture. Security and Integrity. Database Security. DBMS Security Support. Privileges in SQL. Permissions and Privilege. In This Lecture Database Systems Lecture 14 Natasha Alechina Database Security Aspects of security Access to databases Privileges and views Database Integrity View updating, Integrity constraints For more

More information

SQL DATA DEFINITION: KEY CONSTRAINTS. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 7

SQL DATA DEFINITION: KEY CONSTRAINTS. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 7 SQL DATA DEFINITION: KEY CONSTRAINTS CS121: Introduction to Relational Database Systems Fall 2015 Lecture 7 Data Definition 2 Covered most of SQL data manipulation operations Continue exploration of SQL

More information

Lecture 6. SQL, Logical DB Design

Lecture 6. SQL, Logical DB Design Lecture 6 SQL, Logical DB Design Relational Query Languages A major strength of the relational model: supports simple, powerful querying of data. Queries can be written intuitively, and the DBMS is responsible

More information

Chapter 6: Physical Database Design and Performance. Database Development Process. Physical Design Process. Physical Database Design

Chapter 6: Physical Database Design and Performance. Database Development Process. Physical Design Process. Physical Database Design Chapter 6: Physical Database Design and Performance Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R. McFadden Robert C. Nickerson ISYS 464 Spring 2003 Topic 23 Database

More information

Database Design Overview. Conceptual Design ER Model. Entities and Entity Sets. Entity Set Representation. Keys

Database Design Overview. Conceptual Design ER Model. Entities and Entity Sets. Entity Set Representation. Keys Database Design Overview Conceptual Design. The Entity-Relationship (ER) Model CS430/630 Lecture 12 Conceptual design The Entity-Relationship (ER) Model, UML High-level, close to human thinking Semantic

More information

Quiz! Database Indexes. Index. Quiz! Disc and main memory. Quiz! How costly is this operation (naive solution)?

Quiz! Database Indexes. Index. Quiz! Disc and main memory. Quiz! How costly is this operation (naive solution)? Database Indexes How costly is this operation (naive solution)? course per weekday hour room TDA356 2 VR Monday 13:15 TDA356 2 VR Thursday 08:00 TDA356 4 HB1 Tuesday 08:00 TDA356 4 HB1 Friday 13:15 TIN090

More information

SQL Tables, Keys, Views, Indexes

SQL Tables, Keys, Views, Indexes CS145 Lecture Notes #8 SQL Tables, Keys, Views, Indexes Creating & Dropping Tables Basic syntax: CREATE TABLE ( DROP TABLE ;,,..., ); Types available: INT or INTEGER REAL or FLOAT CHAR( ), VARCHAR( ) DATE,

More information

CS 377 Database Systems. Database Design Theory and Normalization. Li Xiong Department of Mathematics and Computer Science Emory University

CS 377 Database Systems. Database Design Theory and Normalization. Li Xiong Department of Mathematics and Computer Science Emory University CS 377 Database Systems Database Design Theory and Normalization Li Xiong Department of Mathematics and Computer Science Emory University 1 Relational database design So far Conceptual database design

More information

COMP 378 Database Systems Notes for Chapter 7 of Database System Concepts Database Design and the Entity-Relationship Model

COMP 378 Database Systems Notes for Chapter 7 of Database System Concepts Database Design and the Entity-Relationship Model COMP 378 Database Systems Notes for Chapter 7 of Database System Concepts Database Design and the Entity-Relationship Model The entity-relationship (E-R) model is a a data model in which information stored

More information

How To Create A Table In Sql 2.5.2.2 (Ahem)

How To Create A Table In Sql 2.5.2.2 (Ahem) Database Systems Unit 5 Database Implementation: SQL Data Definition Language Learning Goals In this unit you will learn how to transfer a logical data model into a physical database, how to extend or

More information

SQL: Queries, Programming, Triggers

SQL: Queries, Programming, Triggers SQL: Queries, Programming, Triggers Chapter 5 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 R1 Example Instances We will use these instances of the Sailors and Reserves relations in

More information

www.gr8ambitionz.com

www.gr8ambitionz.com Data Base Management Systems (DBMS) Study Material (Objective Type questions with Answers) Shared by Akhil Arora Powered by www. your A to Z competitive exam guide Database Objective type questions Q.1

More information

CS2Bh: Current Technologies. Introduction to XML and Relational Databases. Introduction to Databases. Why databases? Why not use XML?

CS2Bh: Current Technologies. Introduction to XML and Relational Databases. Introduction to Databases. Why databases? Why not use XML? CS2Bh: Current Technologies Introduction to XML and Relational Databases Spring 2005 Introduction to Databases CS2 Spring 2005 (LN5) 1 Why databases? Why not use XML? What is missing from XML: Consistency

More information

Example Instances. SQL: Queries, Programming, Triggers. Conceptual Evaluation Strategy. Basic SQL Query. A Note on Range Variables

Example Instances. SQL: Queries, Programming, Triggers. Conceptual Evaluation Strategy. Basic SQL Query. A Note on Range Variables SQL: Queries, Programming, Triggers Chapter 5 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Example Instances We will use these instances of the Sailors and Reserves relations in our

More information

Geodatabase Programming with SQL

Geodatabase Programming with SQL DevSummit DC February 11, 2015 Washington, DC Geodatabase Programming with SQL Craig Gillgrass Assumptions Basic knowledge of SQL and relational databases Basic knowledge of the Geodatabase We ll hold

More information

Data Modeling. Database Systems: The Complete Book Ch. 4.1-4.5, 7.1-7.4

Data Modeling. Database Systems: The Complete Book Ch. 4.1-4.5, 7.1-7.4 Data Modeling Database Systems: The Complete Book Ch. 4.1-4.5, 7.1-7.4 Data Modeling Schema: The structure of the data Structured Data: Relational, XML-DTD, etc Unstructured Data: CSV, JSON But where does

More information

14 Databases. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

14 Databases. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to: 14 Databases 14.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define a database and a database management system (DBMS)

More information

MySQL for Beginners Ed 3

MySQL for Beginners Ed 3 Oracle University Contact Us: 1.800.529.0165 MySQL for Beginners Ed 3 Duration: 4 Days What you will learn The MySQL for Beginners course helps you learn about the world's most popular open source database.

More information

Foundations of Information Management

Foundations of Information Management Foundations of Information Management - WS 2012/13 - Juniorprofessor Alexander Markowetz Bonn Aachen International Center for Information Technology (B-IT) Data & Databases Data: Simple information Database:

More information

Relational Databases

Relational Databases Relational Databases Jan Chomicki University at Buffalo Jan Chomicki () Relational databases 1 / 18 Relational data model Domain domain: predefined set of atomic values: integers, strings,... every attribute

More information

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to:

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to: D61830GC30 for Developers Summary Duration Vendor Audience 5 Days Oracle Database Administrators, Developers, Web Administrators Level Technology Professional Oracle 5.6 Delivery Method Instructor-led

More information

OBJECT ORIENTED EXTENSIONS TO SQL

OBJECT ORIENTED EXTENSIONS TO SQL OBJECT ORIENTED EXTENSIONS TO SQL Thomas B. Gendreau Computer Science Department University Wisconsin La Crosse La Crosse, WI 54601 gendreau@cs.uwlax.edu Abstract Object oriented technology is influencing

More information

3. Relational Model and Relational Algebra

3. Relational Model and Relational Algebra ECS-165A WQ 11 36 3. Relational Model and Relational Algebra Contents Fundamental Concepts of the Relational Model Integrity Constraints Translation ER schema Relational Database Schema Relational Algebra

More information

COMP 5138 Relational Database Management Systems. Week 5 : Basic SQL. Today s Agenda. Overview. Basic SQL Queries. Joins Queries

COMP 5138 Relational Database Management Systems. Week 5 : Basic SQL. Today s Agenda. Overview. Basic SQL Queries. Joins Queries COMP 5138 Relational Database Management Systems Week 5 : Basic COMP5138 "Relational Database Managment Systems" J. Davis 2006 5-1 Today s Agenda Overview Basic Queries Joins Queries Aggregate Functions

More information

OBJECTS AND DATABASES. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 21

OBJECTS AND DATABASES. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 21 OBJECTS AND DATABASES CS121: Introduction to Relational Database Systems Fall 2015 Lecture 21 Relational Model and 1NF 2 Relational model specifies that all attribute domains must be atomic A database

More information

SQL: Queries, Programming, Triggers

SQL: Queries, Programming, Triggers SQL: Queries, Programming, Triggers CSC343 Introduction to Databases - A. Vaisman 1 R1 Example Instances We will use these instances of the Sailors and Reserves relations in our examples. If the key for

More information

COSC344 Database Theory and Applications. Lecture 9 Normalisation. COSC344 Lecture 9 1

COSC344 Database Theory and Applications. Lecture 9 Normalisation. COSC344 Lecture 9 1 COSC344 Database Theory and Applications Lecture 9 Normalisation COSC344 Lecture 9 1 Overview Last Lecture Functional Dependencies This Lecture Normalisation Introduction 1NF 2NF 3NF BCNF Source: Section

More information

SQL NULL s, Constraints, Triggers

SQL NULL s, Constraints, Triggers CS145 Lecture Notes #9 SQL NULL s, Constraints, Triggers Example schema: CREATE TABLE Student (SID INTEGER PRIMARY KEY, name CHAR(30), age INTEGER, GPA FLOAT); CREATE TABLE Take (SID INTEGER, CID CHAR(10),

More information

A basic create statement for a simple student table would look like the following.

A basic create statement for a simple student table would look like the following. Creating Tables A basic create statement for a simple student table would look like the following. create table Student (SID varchar(10), FirstName varchar(30), LastName varchar(30), EmailAddress varchar(30));

More information

Part VI. Object-relational Data Models

Part VI. Object-relational Data Models Part VI Overview Object-relational Database Models Concepts of Object-relational Database Models Object-relational Features in Oracle10g Object-relational Database Models Object-relational Database Models

More information

A COMPARISON OF OBJECT-RELATIONAL AND RELATIONAL DATABASES A Thesis Presented to the Faculty of California Polytechnic State University San Luis Obispo In Partial Fulfillment of the Requirements for the

More information

CSC 443 Data Base Management Systems. Basic SQL

CSC 443 Data Base Management Systems. Basic SQL CSC 443 Data Base Management Systems Lecture 6 SQL As A Data Definition Language Basic SQL SQL language Considered one of the major reasons for the commercial success of relational databases SQL Structured

More information

SQL:2003 Has Been Published

SQL:2003 Has Been Published SQL:2003 Has Been Published Andrew Eisenberg IBM, Westford, MA 01886 andrew.eisenberg@us.ibm.com Jim Melton Oracle Corp., Sandy, UT 84093 jim.melton@acm.org Krishna Kulkarni IBM, San Jose, CA 94151 krishnak@us.ibm.com

More information

Triggers & Packages. {INSERT [OR] UPDATE [OR] DELETE}: This specifies the DML operation.

Triggers & Packages. {INSERT [OR] UPDATE [OR] DELETE}: This specifies the DML operation. Triggers & Packages An SQL trigger is a mechanism that automatically executes a specified PL/SQL block (referred to as the triggered action) when a triggering event occurs on the table. The triggering

More information

There are five fields or columns, with names and types as shown above.

There are five fields or columns, with names and types as shown above. 3 THE RELATIONAL MODEL Exercise 3.1 Define the following terms: relation schema, relational database schema, domain, attribute, attribute domain, relation instance, relation cardinality, andrelation degree.

More information

Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1

Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1 Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1 A feature of Oracle Rdb By Ian Smith Oracle Rdb Relational Technology Group Oracle Corporation 1 Oracle Rdb Journal SQL:1999 and Oracle Rdb V7.1 The

More information

DATABASE INTRODUCTION

DATABASE INTRODUCTION Introduction The history of database system research is one of exceptional productivity and startling economic impact. We have learnt that from the days of file-based systems there are better ways to handle

More information

More on SQL. Juliana Freire. Some slides adapted from J. Ullman, L. Delcambre, R. Ramakrishnan, G. Lindstrom and Silberschatz, Korth and Sudarshan

More on SQL. Juliana Freire. Some slides adapted from J. Ullman, L. Delcambre, R. Ramakrishnan, G. Lindstrom and Silberschatz, Korth and Sudarshan More on SQL Some slides adapted from J. Ullman, L. Delcambre, R. Ramakrishnan, G. Lindstrom and Silberschatz, Korth and Sudarshan SELECT A1, A2,, Am FROM R1, R2,, Rn WHERE C1, C2,, Ck Interpreting a Query

More information

David Dye. Extract, Transform, Load

David Dye. Extract, Transform, Load David Dye Extract, Transform, Load Extract, Transform, Load Overview SQL Tools Load Considerations Introduction David Dye derekman1@msn.com HTTP://WWW.SQLSAFETY.COM Overview ETL Overview Extract Define

More information

1 File Processing Systems

1 File Processing Systems COMP 378 Database Systems Notes for Chapter 1 of Database System Concepts Introduction A database management system (DBMS) is a collection of data and an integrated set of programs that access that data.

More information

Oracle 11g PL/SQL training

Oracle 11g PL/SQL training Oracle 11g PL/SQL training Course Highlights This course introduces students to PL/SQL and helps them understand the benefits of this powerful programming language. Students learn to create PL/SQL blocks

More information

Databases 2011 The Relational Model and SQL

Databases 2011 The Relational Model and SQL Databases 2011 Christian S. Jensen Computer Science, Aarhus University What is a Database? Main Entry: da ta base Pronunciation: \ˈdā-tə-ˌbās, ˈda- also ˈdä-\ Function: noun Date: circa 1962 : a usually

More information

SQL Server. 2012 for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach

SQL Server. 2012 for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach TRAINING & REFERENCE murach's SQL Server 2012 for developers Bryan Syverson Joel Murach Mike Murach & Associates, Inc. 4340 N. Knoll Ave. Fresno, CA 93722 www.murach.com murachbooks@murach.com Expanded

More information

Oracle Database: Introduction to SQL

Oracle Database: Introduction to SQL Oracle University Contact Us: +381 11 2016811 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn Understanding the basic concepts of relational databases ensure refined code by developers.

More information

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle Database: SQL and PL/SQL Fundamentals NEW Oracle University Contact Us: 001-855-844-3881 & 001-800-514-06-97 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals

More information

EECS 647: Introduction to Database Systems

EECS 647: Introduction to Database Systems EECS 647: Introduction to Database Systems Instructor: Luke Huan Spring 2013 Administrative Take home background survey is due this coming Friday The grader of this course is Ms. Xiaoli Li and her email

More information

Demystified CONTENTS Acknowledgments xvii Introduction xix CHAPTER 1 Database Fundamentals CHAPTER 2 Exploring Relational Database Components

Demystified CONTENTS Acknowledgments xvii Introduction xix CHAPTER 1 Database Fundamentals CHAPTER 2 Exploring Relational Database Components Acknowledgments xvii Introduction xix CHAPTER 1 Database Fundamentals 1 Properties of a Database 1 The Database Management System (DBMS) 2 Layers of Data Abstraction 3 Physical Data Independence 5 Logical

More information

Oracle Database 11g SQL

Oracle Database 11g SQL AO3 - Version: 2 19 June 2016 Oracle Database 11g SQL Oracle Database 11g SQL AO3 - Version: 2 3 days Course Description: This course provides the essential SQL skills that allow developers to write queries

More information

Chapter 9 Joining Data from Multiple Tables. Oracle 10g: SQL

Chapter 9 Joining Data from Multiple Tables. Oracle 10g: SQL Chapter 9 Joining Data from Multiple Tables Oracle 10g: SQL Objectives Identify a Cartesian join Create an equality join using the WHERE clause Create an equality join using the JOIN keyword Create a non-equality

More information

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT. COURSE CURRICULUM COURSE TITLE: DATABASE MANAGEMENT (Code: 3341605 ) Information Technology

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT. COURSE CURRICULUM COURSE TITLE: DATABASE MANAGEMENT (Code: 3341605 ) Information Technology GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT COURSE CURRICULUM COURSE TITLE: DATABASE MANAGEMENT (Code: 3341605 ) Diploma Programme in which this course is offered Information Technology Semester

More information

Programming with SQL

Programming with SQL Unit 43: Programming with SQL Learning Outcomes A candidate following a programme of learning leading to this unit will be able to: Create queries to retrieve information from relational databases using

More information

Database Design. Adrienne Watt. Port Moody

Database Design. Adrienne Watt. Port Moody Database Design Database Design Adrienne Watt Port Moody Except for third party materials and otherwise stated, content on this site is made available under a Creative Commons Attribution 2.5 Canada License.

More information

Oracle Database: Introduction to SQL

Oracle Database: Introduction to SQL Oracle University Contact Us: 1.800.529.0165 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn View a newer version of this course This Oracle Database: Introduction to SQL training

More information

The Relational Model. Why Study the Relational Model? Relational Database: Definitions. Chapter 3

The Relational Model. Why Study the Relational Model? Relational Database: Definitions. Chapter 3 The Relational Model Chapter 3 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Why Study the Relational Model? Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase,

More information

CSI 2132 Lab 3. Outline 09/02/2012. More on SQL. Destroying and Altering Relations. Exercise: DROP TABLE ALTER TABLE SELECT

CSI 2132 Lab 3. Outline 09/02/2012. More on SQL. Destroying and Altering Relations. Exercise: DROP TABLE ALTER TABLE SELECT CSI 2132 Lab 3 More on SQL 1 Outline Destroying and Altering Relations DROP TABLE ALTER TABLE SELECT Exercise: Inserting more data into previous tables Single-table queries Multiple-table queries 2 1 Destroying

More information

Databasesystemer, forår 2005 IT Universitetet i København. Forelæsning 3: Business rules, constraints & triggers. 3. marts 2005

Databasesystemer, forår 2005 IT Universitetet i København. Forelæsning 3: Business rules, constraints & triggers. 3. marts 2005 Databasesystemer, forår 2005 IT Universitetet i København Forelæsning 3: Business rules, constraints & triggers. 3. marts 2005 Forelæser: Rasmus Pagh Today s lecture Constraints and triggers Uniqueness

More information

Database Programming with PL/SQL: Learning Objectives

Database Programming with PL/SQL: Learning Objectives Database Programming with PL/SQL: Learning Objectives This course covers PL/SQL, a procedural language extension to SQL. Through an innovative project-based approach, students learn procedural logic constructs

More information

Programming Database lectures for mathema

Programming Database lectures for mathema Programming Database lectures for mathematics students April 25, 2015 Functions Functions are defined in Postgres with CREATE FUNCTION name(parameter type,...) RETURNS result-type AS $$ function-body $$

More information

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases. SQL Databases Course by Applied Technology Research Center. 23 September 2015 This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases. Oracle Topics This Oracle Database: SQL

More information

Oracle For Beginners Page : 1

Oracle For Beginners Page : 1 Oracle For Beginners Page : 1 Chapter 22 OBJECT TYPES Introduction to object types Creating object type and object Using object type Creating methods Accessing objects using SQL Object Type Dependencies

More information

SQL SELECT Query: Intermediate

SQL SELECT Query: Intermediate SQL SELECT Query: Intermediate IT 4153 Advanced Database J.G. Zheng Spring 2012 Overview SQL Select Expression Alias revisit Aggregate functions - complete Table join - complete Sub-query in where Limiting

More information

Review: Participation Constraints

Review: Participation Constraints Review: Participation Constraints Does every department have a manager? If so, this is a participation constraint: the participation of Departments in Manages is said to be total (vs. partial). Every did

More information