For student, require values for name and address.

Slides:



Advertisements
Similar presentations
Murali Mani SQL DDL and Oracle utilities. Murali Mani Datatypes in SQL INT (or) INTEGER FLOAT (or) REAL DECIMAL (n, m) CHAR (n) VARCHAR (n) DATE, TIME.
Advertisements

SQL Keys and Constraints Justin Maksim. Key Declaration Key constraint defined within the CREATE TABLE command Key can be declared using either the PRIMARY.
SQL DDL constraints Restrictions on the columns and tables 1SQL DDL Constraints.
INTEGRITY Enforcing integrity in Oracle. Oracle Tables mrobbert owner granted access.
Information Resources Management March 6, Agenda n Administrivia n SQL Part 2 n Homework #6.
SQL Constraints & Triggers May 10 th, Agenda Big picture –what are constraints & triggers? –where do they appear? –why are they important? In SQL.
1 IT420: Database Management and Organization SQL: Structured Query Language 25 January 2006 Adina Crăiniceanu
 SQL stands for Structured Query Language.  SQL lets you access and manipulate databases.  SQL is an ANSI (American National Standards Institute) standard.
SQL Data Definition (CB Chapter 6) CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley.
Databases in Visual Studio. Database in VisualStudio An MS SQL database are built in Visual studio The Name can be something like ”(localdb)\Projects”
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
Deanery of Business & Computer Sciences SQL Structured Query Language Implementation Lecture – 8 Database Technology Level I.
Slide 1 Chapter 7 – Part 1 Data Definition Language & Data Manipulation Language.
SQL Basics. 5/27/2016Chapter 32 of 19 Naming SQL commands are NOT case sensitive SQL commands are NOT case sensitive But user identifier names ARE case.
SQL: DDL. SQL Statements DDL - data definition language –Defining and modifying data structures (metadata): database, tables, views, etc. DML - data manipulation.
Recap of SQL Lab no 8 Advance Database Management System.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
11-1 Copyright  Oracle Corporation, All rights reserved. What Are Constraints? Constraints enforce rules at the table level. Constraints prevent.
1 SQL - II Data Constraints –Applying data constraints Types of data constraints –I/O constraints The PRIMARY KEY constraints The FOREIGN KEY constraints.
CREATE TABLE CREATE TABLE statement is used for creating relations Each column is described with three parts: column name, data type, and optional constraints.
Chapter 7 SQL: Data Definition Pearson Education © 2009.
DBSQL 5-1 Copyright © Genetic Computer School 2009 Chapter 5 Structured Query Language.
SQL introduction 2013.
SQL Structured Query Language. Aims  To introduce the implementation of a Physical design using SQL.  To introduce SQL Data Definition Language (DDL).
Defining NOT NULL and UNIQUE Constraints
Deductive Databases General idea: some relations are stored (extensional), others are defined by datalog queries (intensional). Many research projects.
1 SQL Insert Update Delete Create table Alter table.
SQL Miscellaneous Topics. Views A database view is: – a virtual or logical table based on a query. – a stored query. CREATE VIEW viewname AS query; –CREATE.
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
CREATE TABLE ARTIST ( ArtistID int NOT NULL IDENTITY (1,1), Namechar(25) NOT NULL, TEXT ERROR Nationality char (30) NULL, Birthdate numeric (4,0) NULL,
Chapter 3: Relational Databases
SQL constrains and keys. SORTED RESULTS Sort the results by a specified criterion SELECT columns FROM tables WHERE predicates ORDER BY column ASC/DESC;
Constraints and Views Chap. 3-5 continued (7 th ed. 5-7)
What Is Normalization  In relational database design, the process of organizing data to minimize redundancy  Usually involves dividing a database into.
SQL, the Structured Query Language
Fundamentals of DBMS Notes-1.
Structured Query Language
Fundamental of Database Systems
Database Management System
MySQL-Database Jouni Juntunen Oulu University of Applied Sciences
SQL: Schema Definition and Constraints Chapter 6 week 6
The Basics of Data Manipulation
CS 3630 Database Design and Implementation
Database Keys and Constraints
Referential Integrity MySQL
SQL: Constraints and Triggers
Referential Integrity
Structured Query Language (Data definition Language)
Lecturer: Mukhtar Mohamed Ali “Hakaale”
Index Structure.
لغة قواعد البيانات STRUCTURED QUERY LANGUAGE SQL))
Teaching slides Chapter 8.
The Basics of Data Manipulation
SQL data definition using Oracle
Referential Integrity
אבטחת נתונים בסביבת SQL Data Security
DATABASE SQL= Structure Query Language مبادئ قواعد بيانات
SQL Code for Byrnetube video
مقدمة في قواعد البيانات
ORACLE SQL.
SQL DATA CONSTRAINTS.
Rob Gleasure robgleasure.com
Database Processing: David M. Kroenke’s Chapter Seven:
Session - 6 Sequence - 1 SQL: The Structured Query Language:
Instructor: Samia arshad
កម្មវិធីបង្រៀន SQL Programming ជាភាសាខ្មែរ Online SQL Training Course
SQLDeveloper Data Modeler - Logical Model
កម្មវិធីបង្រៀន SQL Programming ជាភាសាខ្មែរ Online SQL Training Course
SQL (Structured Query Language)
SQL AUTO INCREMENT Field
Presentation transcript:

For student, require values for name and address. For advisor, require values for name, phone, and email. For advisor, make values for email unique.

SQL DDL Example CREATE TABLE student (pid varchar(9), name varchar(25) NOT NULL, address varchar(50) NOT NULL, phone varchar(15), email varchar(25), PRIMARY KEY (pid)); CREATE TABLE advisor (emp_id varchar(5) CONSTRAINT pk_adv PRIMARY KEY, name varchar(25) NOT NULL, office varchar(25), phone varchar(6) NOT NULL, email varchar(25) NOT NULL, UNIQUE (email));

SQL DDL Example CREATE TABLE st_adv (pid varchar(9) CONTRAINT fk_st REFERENCES student(pid) ON DELETE CASCADE ON UPDATE CASCADE, emp_id varchar(5), PRIMARY KEY (pid, emp_id), FOREIGN KEY (emp_id) REFERENCES advisor(emp_id) ON DELETE CASCADE ON UPDATE CASCADE; CREATE INDEX sid_x ON student(pid); CREATE INDEX emp_x ON advisor(emp_id); CREATE INDEX adv_stx ON st_adv(pid, emp_id);