Ciljevi. Poslije kompletiranja ove lekcije trebalo bi se biti u mogućnosti: Opisati ograničenja Generisati i održavati ograničenja u bazi

Size: px
Start display at page:

Download "Ciljevi. Poslije kompletiranja ove lekcije trebalo bi se biti u mogućnosti: Opisati ograničenja Generisati i održavati ograničenja u bazi"

Transcription

1 Ograničenja

2 Ciljevi Poslije kompletiranja ove lekcije trebalo bi se biti u mogućnosti: Opisati ograničenja Generisati i održavati ograničenja u bazi Generisati i održavati ograničenja u bazi podataka

3 Uvod Šta su ograničenja (eng. constraints)? Nametnuta pravila za tabele Pravila koja onemogućavaju brisanje tabela ako postoje zavisnosti Prvila koja onemogućavaju ažuriranje vrijednosti podataka u kolonama ako nad njima postoje definisani referencijalni integriteti Postoje sljedeći tipovi ograničenja nad kolonama tabele: NOT NULL UNIQUE PRIMARY KEY FOREIGN KEY CHECK

4 Ograničena ORACLE Imena ograničenja, ako se automatski generišu, imenuju se u formatu SYS_Cn gdje je n redni broj ograničenja Kreiranje ograničenja se generiše: Kada se kreira tabela ili Nakon kreiranja tabele nepostrednim korištenjem komante ALTER TABLE ADD CONSTRAINT Ograničenja se definišu na nivou kolone ili tabele Sva ograničenja (eng. constraints) se zapisuju u šemi baze podataka, a vidljivi su putem Data Dictionary-a

5 Definisanje ograničenja CREATE TABLE [schema.]table (column datatype [DEFAULT expr] [column_constraint],... [table_constraint][,...]); CREATE TABLE emp( empno NUMBER(4), ename VARCHAR2(10),... deptno NUMBER(2) NOT NULL, CONSTRAINT emp_empno_pk PRIMARY KEY (EMPNO));

6 Definisanje ograničenja Ograničenje na nivou kolone column [CONSTRAINT constraint_name] constraint_type, Ograničenje na nivou tabele column,... [CONSTRAINT constraint_name] constraint_type (column,...),

7 NOT NULL ograničenja SQL> CREATE TABLE employees 2 (employee_id NUMBER(6,0) NOT NULL, 3 first_name VARCHAR2(20), 4 last_name VARCHAR2(25) NOT NULL, 5 VARCHAR2(25) NOT NULL, 6 phone_number VARCHAR2(20), 7 hire_date DATE NOT NULL, 8 job_id VARCHAR2(10) NOT NULL, 9 salary NUMBER(8,2), 10 commission_pct NUMBER(2,2), 11 manager_id NUMBER(6,0), 12 department_id NUMBER(4,0)); EMPLOYEE_ID LAST_NAME HIRE_DATE MANAGER_ID DEPARTMENT_ID 198 OConnell 21-Jun King 17-Jun Chen 28-Sep Tobias 24-Jul Grant 24-May NOT NULL NOT NULL NOT NULL DOZVOLJENE SU NULL VRIJEDNOSTI

8 NOT NULL ograničenja SQL> CREATE TABLE emp( employee_id NUMBER(6), 2 last_name VARCHAR2(25) NOT NULL, 3 salary NUMBER(8,2), 4 commission_pct NUMBER(2,2), 5 hire_date DATE 6 CONSTRAINT emp_hire_date_nn NOT NULL,... Kolona last_name hire_date Ograničenje SYS_C EMP_HIREDATE_NN Sistemski dodijeljen naziv ograničenja Eksplicitno dodijeljen naziv ograničenja

9 UNIQUE ograničenje SQL> CREATE TABLE dept( department_id NUMBER(6), 2 department_name VARCHAR2(25) UNIQUE, 3 location_id NUMBER(4,0), 3 manager_id NUMBER(6,0) 4 CONSTRAINT dept_manid_uq UNIQUE, 5... Kolona department_name Ograničenje SYS_C manager_id DEPT_MANID_UQ Sistemski dodijeljen naziv ograničenja Eksplicitno dodijeljen naziv ograničenja Department_id Department_name Location_id Manager_id 10 Administration IT Executive Insert novog sloga 120 Prodaja

10 PRIMARY KEY ograničenje Dozvoljeno je definisanje primarnog ključa ili na novou tabele ili na nivou kolone SQL> CREATE TABLE dept( 2 deptno NUMBER(2), 3 dname VARCHAR2(14), 4 loc VARCHAR2(13), 5 CONSTRAINT dept_dname_uk UNIQUE (dname), 6 CONSTRAINT dept_deptno_pk PRIMARY KEY(deptno)); SQL> CREATE TABLE emp( 2 empno NUMBER(6,0) PRIMARY KEY, 3 ename VARCHAR2(14), 4 job VARCHAR2(30),...

11 FOREIGN KEY ograničenje DEPT PRIMARY KEY DEPTNO DNAME LOC 10 Administration New York 20 Sales Dallas PRIMARY KEY... FOREIGN KEY EMP EMPNO ENAME JOB... DEPTNO 100 King Steven President OConnell Donald Finance Manager INSERT INTO EMP EMPNO ENAME JOB... DEPTNO 300 King Nubelix Manager King Nubelix Manager 50 Insert nije dozvoljen deptno = 12 ne postoji Dozvoljen insert

12 FOREIGN KEY ograničenje FOREIGN KEY ograničenje moguće je definisati na nivou tabele ili na nivou kolone SQL> CREATE TABLE emp( 2 empno NUMBER(4), 3 ename VARCHAR2(10) NOT NULL, 4 job VARCHAR2(9), 5 mgr NUMBER(4), 6 hiredate DATE, 7 sal NUMBER(7,2), 8 comm NUMBER(7,2), 9 deptno NUMBER(7,2) NOT NULL, 10 CONSTRAINT emp_deptno_fk FOREIGN KEY (deptno) 11 REFERENCES dept (deptno)); FOREIGN KEY određuje kolonu u podređenoj tabeli na nivou ograničenja tabele REFERENCES određuje kolonu u nadređenoj tabeli ON DELETE CASCADE omogućava brisanje redova u nadređenoj tabeli i svih zavisnih redova (slogova) u podređenoj tabeli

13 CHECK ograničenje Definiše uslov koji svaki red mora zadovoljavati Izrazi koji nisu dozvoljeni: Referenciranje na: CURRVAL, NEXTVAL, LEVEL i ROWNUM pseoudo kolone Poziv na SYSDATE, UID, USER funkcije Upite koji se odnose na vrijednosti iz drugih redova..., deptno NUMBER(2), CONSTRAINT emp_deptno_ck CHECK (DEPTNO BETWEEN 10 AND 99),...

14 Dodavanje ograničenja Dozvoljeno je dodavanje ili brisanje, ali ne i modifikovanje ograničenja Omogućavanje ili onemogućavanje ograničenja Dodavanje NOT NULL ograničenja putem MODIFY klauzule ALTER TABLE table ADD [CONSTRAINT constraint] type (column);

15 Dodavanje ograničenja SQL> ALTER TABLE emp 2 ADD CONSTRAINT emp_mgr_fk 3 FOREIGN KEY(mgr) REFERENCES emp(empno); Table altered. Dodavanje ograničenja nad tabelom emp i kolonom mgr (manager) inicira da zaposleni mora već postojati u tabeli emp da bi bilo moguće popuniti ovu kolonu sa nekom od dozvoljenih vrijednosti.

16 Brisanje ograničenja Brisanje ograničenja za manager-a iz tabele emp SQL> ALTER TABLE emp 2 DROP CONSTRAINT emp_mgr_fk; Table altered. Brisanje primarnog ključa nad tabelom DEPT i svi foreign key-a u tabeli EMP nad kolonom DEPTNO (tj. EMP.DEPTO) SQL> ALTER TABLE dept 2 DROP PRIMARY KEY CASCADE; Table altered.

17 Deaktiviranje i aktiviranje ograničenja Izvršenjem DISABLE klauzule ALTER TABLE iskaza deaktivira se integritet ograničenja Prihvatanjem CASCADE opcije onemogućava se zavisnost cjelokupnog ograničenja SQL> ALTER TABLE emp 2 DISABLE CONSTRAINT emp_empno_pk CASCADE; Table altered. Izvršenjem ENABLE klauzule ALTER TABLE iskaza aktivira se integritet ograničenja UNIQUE i PRIMARY KEY indeksi se automatski kreiraju kada se aktiviraju UNIQUE i PRIMARY KEY ograničenja SQL> ALTER TABLE emp 2 ENABLE CONSTRAINT emp_empno_pk; Table altered.

18 Kaskadno ograničenje Klauzula CASCADE CONSTRAINTS se koristi zajedno s klauzulom DROP COLUMN CASCADE CONSTRAINTS klauzula briše sva referencijalna ograničenja koja se odnose na PRIMARY KEY i UNIQUE KEY definisane nad kolonom koja se briše CASCADE CONSTRAINTS klauzula takođe briše sva ograničenja definisana nad više kolona kada se briše bar jedna kolona iz ograničenja

19 Pregled ograničenja Upitom na USER_CONSTRAINTS tabelu mogu se vidjeti sva definisana ograničenja SQL> SELECT constraint_name, constraint_type, 2 search_condition 3 FROM user_constraints 4 WHERE table_name = 'EMPLOYEES'; CONSTRAINT_NAME C SEARCH_CONDITION EMP_LAST_NAME_NN C "LAST_NAME" IS NOT NULL EMP_HIRE_DATE_NN C "HIRE_DATE" IS NOT NULL EMP_ _UK U EMP_EMPNO_PK P...

20 Pregled kolona koje imaju pridružena ograničenja Pregled kolona kojima je pridružena ograničenja mogu se vidjeti u tabeli USER_CONS_COLUMNS SQL> SELECT constraint_name, column_name 2 FROM user_cons_columns 3 WHERE table_name = 'EMPLOYEES'; CONSTRAINT_NAME COLUMN_NAME EMP_HIRE_DATE_NN HIRE_DATE EMP_ _UK EMP_EMP_ID_PK EMPLOYEE_ID EMP_MANAGER_FK EMPNO EMP_DEPT_FK DEPARTMENT_ID...

21 Kratak pregled Tipovi ograničenja koji se mogu definisati nad bazom podataka prilikom kreiranja tabela su: NOT NULL UNIQUE PRIMARY KEY FOREIGN KEY CHECK USER_CONSTRAINTS i USER_CONS_COLUMNS su tabele preko kojih se mogu vidjeti sve potrebne informacije vezane za definisana ograničenja nad kolonama tabela

22 Ograničenja

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

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

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

VRIJEDNOSTI ATRIBUTA

VRIJEDNOSTI ATRIBUTA VRIJEDNOSTI ATRIBUTA Svaki atribut (bilo da je primarni ključ, vanjski ključ ili običan atribut) može i ne mora imati ograničenja na svojim vrijednostima. Neka od ograničenja nad atributima: Null / Not

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

Jezik Baze Podataka SQL. Jennifer Widom

Jezik Baze Podataka SQL. Jennifer Widom Jezik Baze Podataka SQL SQL o Jezik koji se koristi u radu sa relacionim bazama podataka o Nije programski jezik i manje je kompleksan. o Koristi se isključivo u radu za bazama podataka. o SQL nije case

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

Manipulating Data. Copyright 2004, Oracle. All rights reserved.

Manipulating Data. Copyright 2004, Oracle. All rights reserved. Manipulating Data Copyright 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Describe each data manipulation language (DML) statement

More information

Ime ograničenja je clients_client_num_pk. Ono inforsira biznis pravila po kojem client_number je PK u clients tabeli Naming Constraints

Ime ograničenja je clients_client_num_pk. Ono inforsira biznis pravila po kojem client_number je PK u clients tabeli Naming Constraints Database Programming with SQL kurs 2017 database design and programming with sql students slajdovi 14-1 Intro to Constraints; NOT NULL and UNIQUE Constraints Ograničenja (constraints) se koriste za sprečavanje

More information

Oracle Database SQL Basics

Oracle Database SQL Basics Oracle Database SQL Basics Kerepes Tamás, Webváltó Kft. tamas.kerepes@webvalto.hu 2015. február 26. Copyright 2004, Oracle. All rights reserved. SQL a history in brief The relational database stores data

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

Data Manipulation Language

Data Manipulation Language Manipulating Data Objectives After completing this lesson, you should be able to do the following: Describe each data manipulation language (DML) statement Insert rows into a table Update rows in a table

More information

King Fahd University of Petroleum and Minerals

King Fahd University of Petroleum and Minerals 1 King Fahd University of Petroleum and Minerals Information and Computer Science Department ICS 334: Database Systems Semester 041 Major Exam 1 18% ID: Name: Section: Grades Section Max Scored A 5 B 25

More information

1/42 SQL DDL. CREATE ALTER DROP Schema Table Tablespace Index View Domain Constraint... DECLARE TABLE (DB2)

1/42 SQL DDL. CREATE ALTER DROP Schema Table Tablespace Index View Domain Constraint... DECLARE TABLE (DB2) 1/42 SQL DDL CREATE ALTER DROP Schema Table Tablespace Index View Domain Constraint... DECLARE TABLE (DB2) 2/42 SQL DDL: CREATE SCHEMA CREATE SCHEMA ime-sheme [ AUTHORIZATION ime-vlasnika-sheme] [ CREATE

More information

Série n 6 Bis : Ateliers SQL Data Modeler (Oracle)

Série n 6 Bis : Ateliers SQL Data Modeler (Oracle) Série n 6 Bis : Ateliers SQL Data Modeler (Oracle) Getting started with data Modeler Adding a Table to An Existing Database Purpose This tutorial shows you how to add a table to an existing database using

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2009, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2009, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement

More information

CS2 Current Technologies Lecture 3: SQL - Joins and Subqueries

CS2 Current Technologies Lecture 3: SQL - Joins and Subqueries T E H U N I V E R S I T Y O H F R G E D I N B U CS2 Current Technologies Lecture 3: SQL - Joins and Subqueries Chris Walton (cdw@dcs.ed.ac.uk) 11 February 2002 Multiple Tables 1 Redundancy requires excess

More information

CS2 Current Technologies Note 1 CS2Bh

CS2 Current Technologies Note 1 CS2Bh CS2 Current Technologies Note 1 Relational Database Systems Introduction When we wish to extract information from a database, we communicate with the Database Management System (DBMS) using a query language

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

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

Táblák tartalmának módosítása. Copyright 2004, Oracle. All rights reserved.

Táblák tartalmának módosítása. Copyright 2004, Oracle. All rights reserved. Táblák tartalmának módosítása Copyright 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Describe each data manipulation language (DML)

More information

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement GIFT Department of Computing Science [Spring 2013] CS-217: Database Systems Lab-2 Manual Data Selection and Filtering using the SELECT Statement V1.0 4/12/2016 Introduction to Lab-2 This lab reinforces

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement Copyright 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL

More information

Database Management System. * First install Mysql Database or Wamp Server which contains Mysql Databse.

Database Management System. * First install Mysql Database or Wamp Server which contains Mysql Databse. Database Management System * First install Mysql Database or Wamp Server which contains Mysql Databse. * Installation steps are provided in pdf named Installation Steps of MySQL.pdf or WAMP Server.pdf

More information

Exam: 1Z Title : Introduction to Oracle9i: SQL. Ver :

Exam: 1Z Title : Introduction to Oracle9i: SQL. Ver : Exam: 1Z0-007 Title : Introduction to Oracle9i: SQL Ver : 05.14.04 QUESTION 1 A: This query uses "+" to create outer join as it was in Oracle8i, but it requires also usage of WHERE clause in SELECT statement.b:

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

CREATE DATABASE naziv-baze-podataka [IN naziv-dbspace]

CREATE DATABASE naziv-baze-podataka [IN naziv-dbspace] SQL Vežbe V CREATE DATABASE CREATE DATABASE naziv-baze-podataka [IN naziv-dbspace] [WITH LOG LOG MODE ANSI] [ ON < filespec > [,...n ] ] [ LOG ON < filespec > [,...n ] ] < filespec > ::= ( [ NAME = logical_file_name,

More information

HR Database. Sample Output from TechWriter 2007 for Databases

HR Database. Sample Output from TechWriter 2007 for Databases Table of Contents...3 Tables... 4 COUNTRIES... 5 DEPARTMENTS... 6 EMPLOYEES... 7 JOBS... 9 JOB_HISTORY... 10 LOCATIONS...12 REGIONS...13 Views...14 EMP_DETAILS_VIEW... 15 Procedures...17 SECURE_DML...18

More information

Database Programming - Section 10. Instructor Guide

Database Programming - Section 10. Instructor Guide Database Programming - Section 10 Instructor Guide Table of Contents...1 Lesson 1 - Defining NOT NULL and UNIQUE Constraints...1 What Will I Learn?...2 Why Learn It?...3...4 Try It / Solve It...13 Lesson

More information

Oracle Proprietary Joins Za upite nad više od jedne tabele korišćenjem Oracle proprietary sintakse koristiti join uslov u WHERE izrazu:

Oracle Proprietary Joins Za upite nad više od jedne tabele korišćenjem Oracle proprietary sintakse koristiti join uslov u WHERE izrazu: Database Programming with SQL kurs 2017 database design and programming with sql students slajdovi 7-1 Oracle Equijoin and Cartesian Product Prethodna sekcija se bavila upitima preko više od jedne tabele

More information

CS2 Current Technologies Lecture 2: SQL Programming Basics

CS2 Current Technologies Lecture 2: SQL Programming Basics T E H U N I V E R S I T Y O H F R G E D I N B U CS2 Current Technologies Lecture 2: SQL Programming Basics Dr Chris Walton (cdw@dcs.ed.ac.uk) 4 February 2002 The SQL Language 1 Structured Query Language

More information

Bsc (Hons) Software Engineering. Examinations for / Semester 1. Resit Examinations for BSE/15A/FT & BSE/16A/FT

Bsc (Hons) Software Engineering. Examinations for / Semester 1. Resit Examinations for BSE/15A/FT & BSE/16A/FT Bsc (Hons) Software Engineering Cohort: BSE/16B/FT Examinations for 2017-2018 / Semester 1 Resit Examinations for BSE/15A/FT & BSE/16A/FT MODULE: DATABASE APPLICATION DEVELOPMENT MODULE CODE: DBT2113C

More information

2. What privilege should a user be given to create tables? The CREATE TABLE privilege

2. What privilege should a user be given to create tables? The CREATE TABLE privilege Practice 1: Solutions To complete question 6 and the subsequent questions, you need to connect to the database using isql*plus. To do this, launch the Internet Explorer browser from the desktop of your

More information

SQL Structured Query Language Introduction

SQL Structured Query Language Introduction SQL Structured Query Language Introduction Rifat Shahriyar Dept of CSE, BUET Tables In relational database systems data are represented using tables (relations). A query issued against the database also

More information

Exam : 1Z Title : Introduction to Oracle9i: SQL

Exam : 1Z Title : Introduction to Oracle9i: SQL Exam : 1Z0-007 Title : Introduction to Oracle9i: SQL Ver : 01-15-2009 QUESTION 1: Examine the data in the EMPLOYEES and DEPARTMENTS tables. EMPLOYEES LAST_NAME DEPARTMENT_ID SALARY Getz 10 3000 Davis 20

More information

Introduction. Introduction to Oracle: SQL and PL/SQL

Introduction. Introduction to Oracle: SQL and PL/SQL Introduction Introduction to Oracle: SQL and PL/SQL 1 Objectives After completing this lesson, you should be able to do the following: Discuss the theoretical and physical aspects of a relational database

More information

다양한예제로쉽게배우는 오라클 SQL 과 PL/SQL 서진수저

다양한예제로쉽게배우는 오라클 SQL 과 PL/SQL 서진수저 다양한예제로쉽게배우는 오라클 SQL 과 PL/SQL 서진수저 8 장제약조건을배웁니다 1 1. 제약조건의종류 조건이름 의 미 NOT NULL 이조건이설정된컬럼에는 NULL 값이입력되지못합니다. UNIQUE 이조건이설정된컬럼에는중복된값이입력되지못합니다. PRIMARY KEY 이조건은 NOT NULL + UNIQUE 의의미를가지며테이블내에서데이터들끼리의유일성을보장하는컬럼에설정할수있으며테이블당

More information

GIFT Department of Computing Science. CS-217/224: Database Systems. Lab-5 Manual. Displaying Data from Multiple Tables - SQL Joins

GIFT Department of Computing Science. CS-217/224: Database Systems. Lab-5 Manual. Displaying Data from Multiple Tables - SQL Joins GIFT Department of Computing Science CS-217/224: Database Systems Lab-5 Manual Displaying Data from Multiple Tables - SQL Joins V3.0 5/5/2016 Introduction to Lab-5 This lab introduces students to selecting

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

1z Exam Code: 1z Exam Name: Oracle Database SQL Expert

1z Exam Code: 1z Exam Name: Oracle Database SQL Expert 1z0-047 Number: 1z0-047 Passing Score: 800 Time Limit: 120 min File Version: 12.0 Exam Code: 1z0-047 Exam Name: Oracle Database SQL Expert 1z0-047 QUESTION 1 Which three statements are true regarding single-row

More information

Create Rank Transformation in Informatica with example

Create Rank Transformation in Informatica with example Create Rank Transformation in Informatica with example Rank Transformation in Informatica. Creating Rank Transformation in Inforamtica. Creating target definition using Target designer. Creating a Mapping

More information

SQL Rukovanje podacima

SQL Rukovanje podacima BAZE PODATAKA SQL Rukovanje podacima Neđeljko Lekić Irena Orović www.etf.ac.me www.elektronika.t-com.me U OVOJ LEKCIJI SQL INSERT, UPDATE, i DELETE Rječnik podataka SQL SELECT WHERE klauzule SELECT iz

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

CREATE TABLE COUNTRIES (COUNTRY_ID CHAR(2), COUNTRY_NAME VARCHAR2(40), REGION_ID NUMBER(4)); INSERT INTO COUNTRIES VALUES ('CA','Canada',2); INSERT INTO COUNTRIES VALUES ('DE','Germany',1); INSERT INTO

More information

Real-World Performance Training SQL Introduction

Real-World Performance Training SQL Introduction Real-World Performance Training SQL Introduction Real-World Performance Team Basics SQL Structured Query Language Declarative You express what you want to do, not how to do it Despite the name, provides

More information

RETRIEVING DATA USING THE SQL SELECT STATEMENT

RETRIEVING DATA USING THE SQL SELECT STATEMENT RETRIEVING DATA USING THE SQL SELECT STATEMENT Course Objectives List the capabilities of SQL SELECT statements Execute a basic SELECT statement Development Environments for SQL Lesson Agenda Basic SELECT

More information

Informatics Practices (065) Sample Question Paper 1 Section A

Informatics Practices (065) Sample Question Paper 1 Section A Informatics Practices (065) Sample Question Paper 1 Note 1. This question paper is divided into sections. Section A consists 30 marks. 3. Section B and Section C are of 0 marks each. Answer the questions

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

q Ø v v v v v v v v IBM - 2

q Ø v v v v v v v v IBM - 2 4 q Ø v v v v v v v v 2007 - -IBM - 2 Ø Ø security integrity 2007 - -IBM - 3 4.1 4.1.1 4.1.2 4.1.3 4.1.4 SQL 2007 - -IBM - 4 4.1.1 Ø database security v v DBMS v v v secure database trusted database 2007

More information

Programming Languages

Programming Languages Programming Languages Chapter 19 - Continuations Dr. Philip Cannata 1 Exceptions (define (f n) (let/cc esc (/ 1 (if (zero? n) (esc 1) n)))) > (f 0) 1 > (f 2) 1/2 > (f 1) 1 > Dr. Philip Cannata 2 Exceptions

More information

Database implementation Further SQL

Database implementation Further SQL IRU SEMESTER 2 January 2010 Semester 1 Session 2 Database implementation Further SQL Objectives To be able to use more advanced SQL statements, including Renaming columns Order by clause Aggregate functions

More information

1z0-071.exam.95q 1z0-071 Oracle Database 12c SQL

1z0-071.exam.95q   1z0-071 Oracle Database 12c SQL 1z0-071.exam.95q Number: 1z0-071 Passing Score: 800 Time Limit: 120 min 1z0-071 Oracle Database 12c SQL Exam A QUESTION 1 Evaluate the following two queries: Which statement is true regarding the above

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement

More information

Uvod u relacione baze podataka

Uvod u relacione baze podataka Uvod u relacione baze podataka Ana Spasić 5. čas 1 Podupiti, operatori exists i in 1. Izdvojiti imena i prezimena studenata koji su položili predmet čiji je identifikator 2001. Rešenje korišćenjem spajanja

More information

1Z0-007 ineroduction to oracle9l:sql

1Z0-007 ineroduction to oracle9l:sql ineroduction to oracle9l:sql Q&A DEMO Version Copyright (c) 2007 Chinatag LLC. All rights reserved. Important Note Please Read Carefully For demonstration purpose only, this free version Chinatag study

More information

What are temporary tables? When are they useful?

What are temporary tables? When are they useful? What are temporary tables? When are they useful? Temporary tables exists solely for a particular session, or whose data persists for the duration of the transaction. The temporary tables are generally

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

relacionim bazama podataka (1)

relacionim bazama podataka (1) Tema 09: SQL - jezik za rad s relacionim bazama podataka (1) dr Vladislav Miškovic vmiskovic@singidunum.ac.rs Studijski program Poslovna ekonomija 2016/2017 Sadržaj 1. Jezik SQL (Structured Query Language)

More information

Baze podataka SQL Jezik relacione BP

Baze podataka SQL Jezik relacione BP Baze podataka SQL Jezik relacione BP SQL 1 SQL - Structured Query Language Strukturni upitni jezik za RBP - modifikovana rel. algebra Razvio ga je IBM u okviru projekta System R Danas je SQL ugrađen u

More information

Part III. Data Modelling. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1

Part III. Data Modelling. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1 Part III Data Modelling Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1 Outline of this part (I) 1 Introduction to the Relational Model and SQL Relational Tables Simple Constraints

More information

Oracle 1Z0-007 Introduction to Oracle9i: SQL 210 Q&A

Oracle 1Z0-007 Introduction to Oracle9i: SQL 210 Q&A Oracle 1Z0-007 Introduction to Oracle9i: SQL 210 Q&A Looking for Real Exam Questions for IT Certification Exams! We guarantee you can pass any IT certification exam at your first attempt with just 10-12

More information

SYSTEM CODE COURSE NAME DESCRIPTION SEM

SYSTEM CODE COURSE NAME DESCRIPTION SEM Course: CS691- Database Management System Lab PROGRAMME: COMPUTER SCIENCE & ENGINEERING DEGREE:B. TECH COURSE: Database Management System Lab SEMESTER: VI CREDITS: 2 COURSECODE: CS691 COURSE TYPE: Practical

More information

Databases. Relational Model, Algebra and operations. How do we model and manipulate complex data structures inside a computer system? Until

Databases. Relational Model, Algebra and operations. How do we model and manipulate complex data structures inside a computer system? Until Databases Relational Model, Algebra and operations How do we model and manipulate complex data structures inside a computer system? Until 1970.. Many different views or ways of doing this Could use tree

More information

Restricting and Sorting Data. Copyright 2004, Oracle. All rights reserved.

Restricting and Sorting Data. Copyright 2004, Oracle. All rights reserved. Restricting and Sorting Data Copyright 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Limit the rows that are retrieved by a query Sort

More information

Additional Practice Solutions

Additional Practice Solutions Additional Practice Solutions Additional Practices Solutions The following exercises can be used for extra practice after you have discussed the data manipulation language (DML) and data definition language

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: Write SELECT statements to access data from more than one table using equality and nonequality joins View data that generally

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

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

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

PASS4TEST. IT Certification Guaranteed, The Easy Way!  We offer free update service for one year PASS4TEST \ We offer free update service for one year Exam : 1z0-071 Title : Oracle Database 12c SQL Vendor : Oracle Version : DEMO Get Latest & Valid 1z0-071 Exam's Question and Answers 1 from Pass4test.

More information

Fravo.com. Certification Made Easy. World No1 Cert Guides. Introduction to Oracle9i: SQL Exam 1Z Edition 1.0

Fravo.com. Certification Made Easy. World No1 Cert Guides. Introduction to Oracle9i: SQL Exam 1Z Edition 1.0 Fravo.com Certification Made Easy M C S E, C C N A, C C N P, O C P, C I W, J A V A, S u n S o l a r i s, C h e c k p o i n t World No1 Cert Guides info@fravo.com Introduction to Oracle9i: SQL Exam 1Z0-007

More information

Vendor: Oracle. Exam Code: 1Z Exam Name: Oracle Database SQL Expert. Version: Demo

Vendor: Oracle. Exam Code: 1Z Exam Name: Oracle Database SQL Expert. Version: Demo Vendor: Oracle Exam Code: 1Z0-047 Exam Name: Oracle Database SQL Expert Version: Demo QUESTION 1 Which three possible values can be set for the TIME_ZONE session parameter by using the ALTER SESSION command?

More information

Databases - 4. Other relational operations and DDL. How to write RA expressions for dummies

Databases - 4. Other relational operations and DDL. How to write RA expressions for dummies Databases - 4 Other relational operations and DDL How to write RA expressions for dummies Step 1: Identify the relations required and CP them together Step 2: Add required selections to make the CP Step

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

DEFAULT Values, MERGE, and Multi-Table Inserts. Copyright 2009, Oracle. All rights reserved.

DEFAULT Values, MERGE, and Multi-Table Inserts. Copyright 2009, Oracle. All rights reserved. DEFAULT Values, MERGE, and Multi-Table Inserts What Will I Learn? In this lesson, you will learn to: Understand when to specify a DEFAULT value Construct and execute a MERGE statement Construct and execute

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

Course Overview. Copyright 2010, Oracle and/or its affiliates. All rights reserved.

Course Overview. Copyright 2010, Oracle and/or its affiliates. All rights reserved. Course Overview Course Objectives After completing this course, you should be able to do the following: Manage application navigation by using hierarchical lists with images, database-driven navigation,

More information

Databases IIB: DBMS-Implementation Exercise Sheet 13

Databases IIB: DBMS-Implementation Exercise Sheet 13 Prof. Dr. Stefan Brass January 27, 2017 Institut für Informatik MLU Halle-Wittenberg Databases IIB: DBMS-Implementation Exercise Sheet 13 As requested by the students, the repetition questions a) will

More information

@vmahawar. Agenda Topics Quiz Useful Links

@vmahawar. Agenda Topics Quiz Useful Links @vmahawar Agenda Topics Quiz Useful Links Agenda Introduction Stakeholders, data classification, Rows/Columns DDL Data Definition Language CREATE, ALTER, DROP, TRUNCATE CONSTRAINTS, DATA TYPES DML Data

More information

IT360: Applied Database Systems. SQL: Structured Query Language DDL and DML (w/o SELECT) (Chapter 7 in Kroenke) SQL: Data Definition Language

IT360: Applied Database Systems. SQL: Structured Query Language DDL and DML (w/o SELECT) (Chapter 7 in Kroenke) SQL: Data Definition Language IT360: Applied Database Systems SQL: Structured Query Language DDL and DML (w/o SELECT) (Chapter 7 in Kroenke) 1 Goals SQL: Data Definition Language CREATE ALTER DROP SQL: Data Manipulation Language INSERT

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

[] znači opciono; znači ili. Strana 3 od 5

[] znači opciono; znači ili. Strana 3 od 5 Database Programming with SQL kurs 2017 database design and programming with sql students slajdovi 2-1 Columns Characters and Rows Concatenation (pridruživanje) stanje povezanosti kao kod lanca; unija

More information

Department of Computer Science and Information Systems, College of Business and Technology, Morehead State University

Department of Computer Science and Information Systems, College of Business and Technology, Morehead State University 1 Department of Computer Science and Information Systems, College of Business and Technology, Morehead State University Lecture 3 Part A CIS 311 Introduction to Management Information Systems (Spring 2017)

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

Intermediate SQL: Aggregated Data, Joins and Set Operators

Intermediate SQL: Aggregated Data, Joins and Set Operators Intermediate SQL: Aggregated Data, Joins and Set Operators Aggregated Data and Sorting Objectives After completing this lesson, you should be able to do the following: Identify the available group functions

More information

CS2300: File Structures and Introduction to Database Systems

CS2300: File Structures and Introduction to Database Systems CS2300: File Structures and Introduction to Database Systems Lecture 14: SQL Doug McGeehan From Theory to Practice The Entity-Relationship Model: a convenient way of representing the world. The Relational

More information

School of Computing and Information Technology Session: Spring CSCI835 Database Systems (Bridging Subject) Sample class test 23 July 2018

School of Computing and Information Technology Session: Spring CSCI835 Database Systems (Bridging Subject) Sample class test 23 July 2018 School of Computing and Information Technology Session: Spring 2018 University of Wollongong Lecturer: Janusz R. Getta CSCI835 Database Systems (Bridging Subject) Sample class test 23 July 2018 THE QUESTIONS

More information

BAZE PODATAKA. SQL Opis podataka. Neđeljko Lekić Irena Orović

BAZE PODATAKA. SQL Opis podataka. Neđeljko Lekić Irena Orović BAZE PODATAKA SQL Opis podataka Neđeljko Lekić Irena Orović www.etf.ac.me U OVOJ LEKCIJI SQL SQL jezik SQL, relacioni model i E/R diagram CREATE TABLE Kolone Primarni ključevi Spoljnji ključevi DROP TABLE

More information

Informacioni sistemi i baze podataka

Informacioni sistemi i baze podataka Fakultet tehničkih nauka, Novi Sad Predmet: Informacioni sistemi i baze podataka Dr Slavica Kordić Milanka Bjelica Vojislav Đukić Rad u učionici (1/2) Baze podataka (db2015): Studentska korisnička šema

More information

Introduction to Oracle9i: SQL

Introduction to Oracle9i: SQL Oracle 1z0-007 Introduction to Oracle9i: SQL Version: 22.0 QUESTION NO: 1 Oracle 1z0-007 Exam Examine the data in the EMPLOYEES and DEPARTMENTS tables. You want to retrieve all employees, whether or not

More information

Table : Purchase. Field DataType Size Constraints CustID CHAR 5 Primary key CustName Varchar 30 ItemName Varchar 30 PurchaseDate Date

Table : Purchase. Field DataType Size Constraints CustID CHAR 5 Primary key CustName Varchar 30 ItemName Varchar 30 PurchaseDate Date Q1. Write SQL query for the following : (i) To create above table as per specification given (ii) To insert 02 records as per your choice (iii) Display the Item name, qty & s of all items purchased by

More information

IBM A Assessment: DB2 9 Fundamentals-Assessment. Download Full Version :

IBM A Assessment: DB2 9 Fundamentals-Assessment. Download Full Version : IBM A2090-730 Assessment: DB2 9 Fundamentals-Assessment Download Full Version : http://killexams.com/pass4sure/exam-detail/a2090-730 C. 2 D. 3 Answer: C QUESTION: 294 In which of the following situations

More information

Displaying Data from Multiple Tables. Copyright 2004, Oracle. All rights reserved.

Displaying Data from Multiple Tables. Copyright 2004, Oracle. All rights reserved. Displaying Data from Multiple Tables Copyright 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Write SELECT statements to access data

More information

Oracle 1Z0-047 Exam Questions & Answers

Oracle 1Z0-047 Exam Questions & Answers Oracle 1Z0-047 Exam Questions & Answers Number: 1z0-047 Passing Score: 800 Time Limit: 120 min File Version: 12.2 http://www.gratisexam.com/ Oracle 1Z0-047 Exam Questions & Answers Exam Name: Oracle Database

More information

EXISTS NOT EXISTS WITH

EXISTS NOT EXISTS WITH Subquery II. Objectives After completing this lesson, you should be able to do the following: Write a multiple-column subquery Use scalar subqueries in SQL Solve problems with correlated subqueries Update

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

Retrieving Data from Multiple Tables

Retrieving Data from Multiple Tables Islamic University of Gaza Faculty of Engineering Computer Engineering Dept. Database Lab (ECOM 4113) Lab 5 Retrieving Data from Multiple Tables Eng. Mohammed Alokshiya November 2, 2014 An JOIN clause

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