Full file at

Size: px
Start display at page:

Download "Full file at"

Transcription

1 SQL for SQL Server 1 True/False Questions Chapter 2 Creating Tables and Indexes 1. In order to create a table, three pieces of information must be determined: (1) the table name, (2) the column names, and (3) the column data types. Answer: False Page Reference: 31 Difficulty: Easy 2. The NUMBER data type stores integer, fixed-point and floating-point, and monetary numbers. Answer: True Page Reference: 32 Difficulty: Hard 3. The default T-SQL date format is MM/DD/YY. Answer: False Page Reference: 36 Difficulty: Medium 4. Field names must include their table s name. For example, emp_ssn and emp_salary are fields in the emp table. Answer: False Page Reference: 38 Difficulty: Easy 5. Constraints are different types of data integrity. Answer: True Page Reference: 39 Difficulty: Easy 6. By default a PRIMARY KEY constraint is NOT NULL. Answer: True Page Reference: 40 Difficulty: Medium 7. The ALTER TABLE command can add a new column or modify an existing column. Answer: True Page Reference: 43 Difficulty: Medium 8. PRIMARY KEY constraints are used to enforce referential integrity. Answer: False Page Reference: 45 Difficulty: Easy 9. A FOREIGN KEY constraint cannot reference a column in a table that has not been created yet. Answer: True Page References: Difficulty: Medium 10. The REFERENCES clause is required in a FOREIGN KEY constraint. Answer: True Page Reference: 47 Difficulty: Medium 11. By default the FOREIGN KEY constraint allows the user to delete rows that have associated dependent rows. Answer: False Page Reference: 47 Difficulty: Easy 12. The DELETE command is one of the simplest SQL statements, but can be very dangerous. Answer: True Page Reference: 52 Difficulty: Easy 13. The ALTER command changes the structure of a column, whereas the UPDATE command changes the contents of a column. Answer: True Page Reference: 52 Difficulty: Hard 14. The ROLLBACK command cancels operations to the database.

2 2 Chapter 2 Creating Tables and Indexes Answer: False Page Reference: 53 Difficulty: Hard 15. Indexes cannot be changed. Answer: True Page Reference: 58 Difficulty: Hard Multiple-Choice Questions 16. Numeric data not used for calculations should be stored in a column of what data type? a. FLOAT b. INTEGER c. REAL d. VARCHAR Answer: D Page Reference: 33 Difficulty: Hard 17. The default data format in T-SQL is: a. MM/DD/YYYY b. DD/MM/YYYY c. MMM DD YYYY d. DD-MON-YYYY Answer: C Page Reference: 36 Difficulty: Medium 18. A column or set of columns that uniquely identifies a row. a. Foreign key b. Primary key c. Secondary key d. Unique key Answer: B Page Reference: 39 Difficulty: Easy 19. A constraint that requires that the data values stored in a specific column must fall within some acceptable range of values. a. CHECK constraint b. NOT NULL constraint c. PRIMARY KEY constraint d. UNIQUE constraint Answer: A Page Reference: 40 Difficulty: Medium 20. Which of the following is NOT possible using the ALTER TABLE command? a. Add a new field b. Drop an existing field c. Modify the datatype of an existing field d. Change the name of an existing field Answer: D Page Reference: 44 Difficulty: Hard 21. A column or set of columns used to enforce referential integrity. a. Foreign key b. Primary key c. Secondary key d. Unique key Answer: A Page Reference: 47 Difficulty: Easy

3 SQL for SQL Server Which of the following is NOT a valid optional clause in a FOREIGN KEY constraint? a. On Delete Cascade b. On Delete Modify c. On Delete No Action d. On Update Cascade Answer: B Page Reference: 47 Difficulty: Hard 23. A SQL command that removes a database object. a. DELETE b. DROP c. REMOVE d. TRUCATE Answer: B Page Reference: 50 Difficulty: Medium 24. A SQL command that adds a database object. a. ADD b. CREATE c. INSERT d. MAKE Answer: B Page Reference: 38 Difficulty: Medium 25. A SQL command that changes a database object. a. ALTER b. MODIFY c. REVISE d. UPDATE Answer: A Page Reference: 43 Difficulty: Medium 26. A SQL command that changes one or more values in a row. a. ALTER b. MODIFY c. REVISE d. UPDATE Answer: D Page Reference: 52 Difficulty: Medium 27. A SQL command that removes one or more rows. a. DELETE b. DROP c. REMOVE d. TRUCATE Answer: A Page Reference: 52 Difficulty: Medium 28. A SQL command that adds a row. a. ADD b. CREATE c. INSERT d. MAKE Answer: C Page Reference: 51 Difficulty: Medium 29. Which of the following is NOT a type of limitation on indexes? a. The maximum size of an index entry. b. The maximum number of columns in a composite index.

4 4 Chapter 2 Creating Tables and Indexes c. The number of indexes per table. d. The kind of index only nonclustered are supported. Answer: D Page Reference: 55 Difficulty: Easy Essay Questions 30. Compare and contrast the CHAR and VARCHAR data types. Answer: Both data types store character data. However, the CHAR data type stores fixed-length data (padding it with blank spaces if necessary) and the VARCHAR data type stores variablelength data. Page Reference: 34 Difficulty: Easy 31. What is the TIMESTAMP data type used for? Answer: The TIMESTAMP data type is used to determine the relative time when a data row was last modified or when a data row was initially created. Page Reference: 37 Difficulty: Medium 32. Briefly describe each of the four types of integrity constraints. Answer: The NOT NULL constraint means that a row of data must have a value for the column specified as NOT NULL. The UNIQUE constraint is used to enforce uniqueness for a column value. The CHECK constraint forces data values stored in a specific column to fall within some acceptable range of values. The PRIMARY KEY constraint is used to uniquely identify rows of data. Page References: Difficulty: Hard 33. List at least three changes that can be made using the ALTER TABLE command. Answer: The ALTER TABLE command can: alter existing columns, add new columns, set default column values, disable and re-enable column constraints, and drop a column. Page Reference: 44 Difficulty: Hard 34. Describe referential integrity. Answer: Referential integrity stipulates that values of a foreign key must correspond to values of a primary key in the table that it references or be NULL. Page Reference: 47 Difficulty: Medium 35. Describe the three optional clauses in a FOREIGN KEY constraint. Answer: ON UPDATE CASCADE will propagate any update on the referenced table to the referencing table. ON DELETE CASCADE will propagate any deletion on the referenced table to the referencing table. ON DELETE NO ACTION will reject a deletion of a primary key value unless no foreign key references that value. Page Reference: 47 Difficulty: Hard 36. What is a composite primary key? Answer: A composite primary key is a primary key containing two or more columns in order to uniquely identify each row. Page Reference: 49 Difficulty: Medium 37. Briefly describe the SQL commands to populate, manipulate, and remove rows. Answer: The INSERT command adds a row to a table. The UPDATE command modifies an existing row. The DELETE command removes one or more rows from a table.

5 SQL for SQL Server 5 Page References: Difficulty: Easy 38. How is updating a column different from modifying it? Answer: The ALTER command changes the table structure, but leaves the table data unaffected. The UPDATE command changes the table data, but not the table structure. Page Reference: 52 Difficulty: Medium 39. How are transactions handled in SQL Server by default? Answer: Unlike most relational DBMS products, SQL Server automatically commits after every INSERT, UDPATE, or DELETE operation. Page Reference: 53 Difficulty: Hard 40. What is a derived column? Answer: A derived or computed column where the values stored are derived by computations involving data stored in other columns in the table. Page References: Difficulty: Hard 41. What is the primary benefit of an index? Answer: An index facilitates the rapid retrieval of information from tables. Page Reference: 54 Difficulty: Medium 42. What are the problems when using an index? Answer: All indexes on a table must be updated whenever a row is changed or deleted that is referenced by an index. Indexes also require disk space. Page References: Difficulty: Medium

Full file at

Full file at ch2 True/False Indicate whether the statement is true or false. 1. The SQL command to create a database table is an example of DML. 2. A user schema contains all database objects created by a user. 3.

More information

EGCI 321: Database Systems. Dr. Tanasanee Phienthrakul

EGCI 321: Database Systems. Dr. Tanasanee Phienthrakul 1 EGCI 321: Database Systems Dr. Tanasanee Phienthrakul 2 Chapter 10 Data Definition Language (DDL) 3 Basic SQL SQL language Considered one of the major reasons for the commercial success of relational

More information

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

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

More information

SQL DATA DEFINITION LANGUAGE

SQL DATA DEFINITION LANGUAGE SQL DATA DEFINITION LANGUAGE DATABASE SCHEMAS IN SQL SQL is primarily a query language, for getting information from a database. DML: Data Manipulation Language SFWR ENG 3DB3 FALL 2016 MICHAEL LIUT (LIUTM@MCMASTER.CA)

More information

Chapter 4. Basic SQL. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Chapter 4. Basic SQL. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 Basic SQL Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 Outline SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries

More information

SQL DATA DEFINITION LANGUAGE

SQL DATA DEFINITION LANGUAGE SQL DATA DEFINITION LANGUAGE DATABASE SCHEMAS IN SQL SQL is primarily a query language, for getting information from a database. DML: Data Manipulation Language SFWR ENG 3DB3 FALL 2016 MICHAEL LIUT (LIUTM@MCMASTER.CA)

More information

SQL DATA DEFINITION LANGUAGE

SQL DATA DEFINITION LANGUAGE 9/27/16 DATABASE SCHEMAS IN SQL SQL DATA DEFINITION LANGUAGE SQL is primarily a query language, for getting information from a database. SFWR ENG 3DB3 FALL 2016 But SQL also includes a data-definition

More information

Creating Tables, Defining Constraints. Rose-Hulman Institute of Technology Curt Clifton

Creating Tables, Defining Constraints. Rose-Hulman Institute of Technology Curt Clifton Creating Tables, Defining Constraints Rose-Hulman Institute of Technology Curt Clifton Outline Data Types Creating and Altering Tables Constraints Primary and Foreign Key Constraints Row and Tuple Checks

More information

D B M G. SQL language: basics. Managing tables. Creating a table Modifying table structure Deleting a table The data dictionary Data integrity

D B M G. SQL language: basics. Managing tables. Creating a table Modifying table structure Deleting a table The data dictionary Data integrity SQL language: basics Creating a table Modifying table structure Deleting a table The data dictionary Data integrity 2013 Politecnico di Torino 1 Creating a table Creating a table (1/3) The following SQL

More information

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

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

More information

SQL: Data Definition Language

SQL: Data Definition Language SQL: Data Definition Language CSC 343 Winter 2018 MICHAEL LIUT (MICHAEL.LIUT@UTORONTO.CA) DEPARTMENT OF MATHEMATICAL AND COMPUTATIONAL SCIENCES UNIVERSITY OF TORONTO MISSISSAUGA Database Schemas in SQL

More information

Fname A variable character field up to 15 characters in length. Must have a value Lname A variable character field up to 15

Fname A variable character field up to 15 characters in length. Must have a value Lname A variable character field up to 15 Customer Table CUSTOMER (CustomerNo, fname, lname, phone) CustomerNo Primary key, numeric, 4 digits Fname A variable character field up to 15 characters in length. Must have a value Lname A variable character

More information

Lab # 4. Data Definition Language (DDL)

Lab # 4. Data Definition Language (DDL) Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Lab # 4 Data Definition Language (DDL) Eng. Haneen El-Masry November, 2014 2 Objective To be familiar with

More information

Chapter 4. Basic SQL. SQL Data Definition and Data Types. Basic SQL. SQL language SQL. Terminology: CREATE statement

Chapter 4. Basic SQL. SQL Data Definition and Data Types. Basic SQL. SQL language SQL. Terminology: CREATE statement Chapter 4 Basic SQL Basic SQL SQL language Considered one of the major reasons for the commercial success of relational databases SQL Structured Query Language Statements for data definitions, queries,

More information

Handout 6 CS-605 Spring 18 Page 1 of 7. Handout 6. Physical Database Modeling

Handout 6 CS-605 Spring 18 Page 1 of 7. Handout 6. Physical Database Modeling Handout 6 CS-605 Spring 18 Page 1 of 7 Handout 6 Physical Database Modeling Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create

More information

Constraints. Primary Key Foreign Key General table constraints Domain constraints Assertions Triggers. John Edgar 2

Constraints. Primary Key Foreign Key General table constraints Domain constraints Assertions Triggers. John Edgar 2 CMPT 354 Constraints Primary Key Foreign Key General table constraints Domain constraints Assertions Triggers John Edgar 2 firstname type balance city customerid lastname accnumber rate branchname phone

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

SQL Functionality SQL. Creating Relation Schemas. Creating Relation Schemas

SQL Functionality SQL. Creating Relation Schemas. Creating Relation Schemas SQL SQL Functionality stands for Structured Query Language sometimes pronounced sequel a very-high-level (declarative) language user specifies what is wanted, not how to find it number of standards original

More information

The Relational Model of Data (ii)

The Relational Model of Data (ii) ICS 321 Fall 2013 The Relational Model of Data (ii) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 1 Defining Relational Schema in SQL Two aspects: Data

More information

MTAT Introduction to Databases

MTAT Introduction to Databases MTAT.03.105 Introduction to Databases Lecture #6 Constraints Ljubov Jaanuska (ljubov.jaanuska@ut.ee) Lecture 5. Summary E-R model according to Crow s Foot notation Model normalization Lecture 2-3. What

More information

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

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

More information

Chapter 1 SQL and Data

Chapter 1 SQL and Data Chapter 1 SQL and Data What is SQL? Structured Query Language An industry-standard language used to access & manipulate data stored in a relational database E. F. Codd, 1970 s IBM 2 What is Oracle? A relational

More information

SQL: Data Definition Language. csc343, Introduction to Databases Diane Horton Fall 2017

SQL: Data Definition Language. csc343, Introduction to Databases Diane Horton Fall 2017 SQL: Data Definition Language csc343, Introduction to Databases Diane Horton Fall 2017 Types Table attributes have types When creating a table, you must define the type of each attribute. Analogous to

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 6 Basic SQL Slide 6-2 Chapter 6 Outline SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries in SQL INSERT, DELETE, and UPDATE Statements in SQL Additional Features

More information

Lab # 2. Data Definition Language (DDL) Eng. Alaa O Shama

Lab # 2. Data Definition Language (DDL) Eng. Alaa O Shama The Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Database Lab Lab # 2 Data Definition Language (DDL) Eng. Alaa O Shama October, 2015 Objective To be familiar

More information

Chapter 17: Table & Integrity Contraints. Informatics Practices Class XII. By- Rajesh Kumar Mishra. KV No.1, AFS, Suratgarh

Chapter 17: Table & Integrity Contraints. Informatics Practices Class XII. By- Rajesh Kumar Mishra. KV No.1, AFS, Suratgarh Chapter 17: Table & Integrity Contraints Informatics Practices Class XII By- Rajesh Kumar Mishra PGT (Comp.Sc.) KV No.1, AFS, Suratgarh e-mail : rkmalld@gmail.com Integrity Constraints One of the major

More information

IBM DB2 UDB V7.1 Family Fundamentals.

IBM DB2 UDB V7.1 Family Fundamentals. IBM 000-512 DB2 UDB V7.1 Family Fundamentals http://killexams.com/exam-detail/000-512 Answer: E QUESTION: 98 Given the following: A table containing a list of all seats on an airplane. A seat consists

More information

Lecture 07. Spring 2018 Borough of Manhattan Community College

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

More information

INTRODUCTION TO DATABASE

INTRODUCTION TO DATABASE 1 INTRODUCTION TO DATABASE DATA: Data is a collection of raw facts and figures and is represented in alphabets, digits and special characters format. It is not significant to a business. Data are atomic

More information

COGS 121 HCI Programming Studio. Week 03 - Tech Lecture

COGS 121 HCI Programming Studio. Week 03 - Tech Lecture COGS 121 HCI Programming Studio Week 03 - Tech Lecture Housekeeping Assignment #1 extended to Monday night 11:59pm Assignment #2 to be released on Tuesday during lecture Database Management Systems and

More information

Slides by: Ms. Shree Jaswal

Slides by: Ms. Shree Jaswal Slides by: Ms. Shree Jaswal Overview of SQL, Data Definition Commands, Set operations, aggregate function, null values, Data Manipulation commands, Data Control commands, Views in SQL, Complex Retrieval

More information

Chapter Five Physical Database Design

Chapter Five Physical Database Design Chapter Five Physical Database Design 1 Objectives Understand Purpose of physical database design Describe the physical database design process Choose storage formats for attributes Describe indexes and

More information

GlobAl EDITION. Database Concepts SEVENTH EDITION. David M. Kroenke David J. Auer

GlobAl EDITION. Database Concepts SEVENTH EDITION. David M. Kroenke David J. Auer GlobAl EDITION Database Concepts SEVENTH EDITION David M. Kroenke David J. Auer This page is intentionally left blank. Chapter 3 Structured Query Language 157 the comment. We will use similar comments

More information

1 INTRODUCTION TO EASIK 2 TABLE OF CONTENTS

1 INTRODUCTION TO EASIK 2 TABLE OF CONTENTS 1 INTRODUCTION TO EASIK EASIK is a Java based development tool for database schemas based on EA sketches. EASIK allows graphical modeling of EA sketches and views. Sketches and their views can be converted

More information

COSC344 Database Theory and Applications. Lecture 5 SQL - Data Definition Language. COSC344 Lecture 5 1

COSC344 Database Theory and Applications. Lecture 5 SQL - Data Definition Language. COSC344 Lecture 5 1 COSC344 Database Theory and Applications Lecture 5 SQL - Data Definition Language COSC344 Lecture 5 1 Overview Last Lecture Relational algebra This Lecture Relational algebra (continued) SQL - DDL CREATE

More information

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

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

More information

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

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

More information

SQL Data Definition: Table Creation

SQL Data Definition: Table Creation SQL Data Definition: Table Creation ISYS 464 Spring 2002 Topic 11 Student Course Database Student (Student Number, Student Name, Major) Course (Course Number, Course Name, Day, Time) Student Course (Student

More information

Announcements (September 18) SQL: Part II. Solution 1. Incomplete information. Solution 3? Solution 2. Homework #1 due today (11:59pm)

Announcements (September 18) SQL: Part II. Solution 1. Incomplete information. Solution 3? Solution 2. Homework #1 due today (11:59pm) Announcements (September 18) 2 SQL: Part II Homework #1 due today (11:59pm) Submit in class, slide underneath my office door Sample solution available Thursday Homework #2 assigned today CPS 116 Introduction

More information

Data Modelling and Databases. Exercise Session 7: Integrity Constraints

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

More information

HOW TO CREATE AND MAINTAIN DATABASES AND TABLES. By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL

HOW TO CREATE AND MAINTAIN DATABASES AND TABLES. By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL HOW TO CREATE AND MAINTAIN DATABASES AND TABLES By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate

More information

Course Prerequisites: This course requires that you meet the following prerequisites:

Course Prerequisites: This course requires that you meet the following prerequisites: Developing MS SQL Server Databases This five-day instructor-led course introduces SQL Server 2014 and describes logical table design, indexing and query plans. It also focusses on the creation of database

More information

Module 9: Managing Schema Objects

Module 9: Managing Schema Objects Module 9: Managing Schema Objects Overview Naming guidelines for identifiers in schema object definitions Storage and structure of schema objects Implementing data integrity using constraints Implementing

More information

Databases 1. Defining Tables, Constraints

Databases 1. Defining Tables, Constraints Databases 1 Defining Tables, Constraints DBMS 2 Rest of SQL Defining a Database Schema Primary Keys, Foreign Keys Local and Global Constraints Defining Views Triggers 3 Defining a Database Schema A database

More information

doc. RNDr. Tomáš Skopal, Ph.D. RNDr. Michal Kopecký, Ph.D.

doc. RNDr. Tomáš Skopal, Ph.D. RNDr. Michal Kopecký, Ph.D. course: Database Systems (NDBI025) SS2017/18 doc. RNDr. Tomáš Skopal, Ph.D. RNDr. Michal Kopecký, Ph.D. Department of Software Engineering, Faculty of Mathematics and Physics, Charles University in Prague

More information

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

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

More information

CSC 453 Database Technologies. Tanu Malik DePaul University

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

More information

Comp 5311 Database Management Systems. 4b. Structured Query Language 3

Comp 5311 Database Management Systems. 4b. Structured Query Language 3 Comp 5311 Database Management Systems 4b. Structured Query Language 3 1 SQL as Data Definition Language Creates the Students relation. The type (domain) of each field is specified, and enforced by the

More information

Principles of Data Management

Principles of Data Management Principles of Data Management Alvin Lin August 2018 - December 2018 Structured Query Language Structured Query Language (SQL) was created at IBM in the 80s: SQL-86 (first standard) SQL-89 SQL-92 (what

More information

Where Are We? Next Few Lectures. Integrity Constraints Motivation. Constraints in E/R Diagrams. Keys in E/R Diagrams

Where Are We? Next Few Lectures. Integrity Constraints Motivation. Constraints in E/R Diagrams. Keys in E/R Diagrams Where Are We? Introduction to Data Management CSE 344 Lecture 15: Constraints We know quite a bit about using a DBMS Start with real-world problem, design ER diagram From ER diagram to relations -> conceptual

More information

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

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

More information

Basic SQL. Basic SQL. Basic SQL

Basic SQL. Basic SQL. Basic SQL Basic SQL Dr Fawaz Alarfaj Al Imam Mohammed Ibn Saud Islamic University ACKNOWLEDGEMENT Slides are adopted from: Elmasri & Navathe, Fundamentals of Database Systems MySQL Documentation Basic SQL Structured

More information

SQL language. Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c)

SQL language. Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c) SQL language Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c) 2011-2016 SQL - Structured Query Language SQL is a computer language for communicating with DBSM Nonprocedural (declarative) language What

More information

Overview. Data Integrity. Three basic types of data integrity. Integrity implementation and enforcement. Database constraints Transaction Trigger

Overview. Data Integrity. Three basic types of data integrity. Integrity implementation and enforcement. Database constraints Transaction Trigger Data Integrity IT 4153 Advanced Database J.G. Zheng Spring 2012 Overview Three basic types of data integrity Integrity implementation and enforcement Database constraints Transaction Trigger 2 1 Data Integrity

More information

[MS20464]: Developing Microsoft SQL Server 2014 Databases

[MS20464]: Developing Microsoft SQL Server 2014 Databases [MS20464]: Developing Microsoft SQL Server 2014 Databases Length : 5 Days Audience(s) : IT Professionals Level : 300 Technology : SQL Server Delivery Method : Instructor-led (Classroom) Course Overview

More information

CS275 Intro to Databases

CS275 Intro to Databases CS275 Intro to Databases The Relational Data Model Chap. 3 How Is Data Retrieved and Manipulated? Queries Data manipulation language (DML) Retrieval Add Delete Update An Example UNIVERSITY database Information

More information

SQL: Data De ni on. B0B36DBS, BD6B36DBS: Database Systems. h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 3

SQL: Data De ni on. B0B36DBS, BD6B36DBS: Database Systems. h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 3 B0B36DBS, BD6B36DBS: Database Systems h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 3 SQL: Data De ni on Mar n Svoboda mar n.svoboda@fel.cvut.cz 13. 3. 2018 Czech Technical University

More information

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

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

More information

SQL - Subqueries and. Schema. Chapter 3.4 V4.0. Napier University

SQL - Subqueries and. Schema. Chapter 3.4 V4.0. Napier University SQL - Subqueries and Chapter 3.4 V4.0 Copyright @ Napier University Schema Subqueries Subquery one SELECT statement inside another Used in the WHERE clause Subqueries can return many rows. Subqueries can

More information

Chapter 2. DB2 concepts

Chapter 2. DB2 concepts 4960ch02qxd 10/6/2000 7:20 AM Page 37 DB2 concepts Chapter 2 Structured query language 38 DB2 data structures 40 Enforcing business rules 49 DB2 system structures 52 Application processes and transactions

More information

Chapter 9: Working with MySQL

Chapter 9: Working with MySQL Chapter 9: Working with MySQL Informatics Practices Class XI (CBSE Board) Revised as per CBSE Curriculum 2015 Visit www.ip4you.blogspot.com for more. Authored By:- Rajesh Kumar Mishra, PGT (Comp.Sc.) Kendriya

More information

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

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

More information

Concepts of Database Management Seventh Edition. Chapter 4 The Relational Model 3: Advanced Topics

Concepts of Database Management Seventh Edition. Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition Chapter 4 The Relational Model 3: Advanced Topics Views View: application program s or individual user s picture of the database Less involved than full

More information

user specifies what is wanted, not how to find it

user specifies what is wanted, not how to find it SQL stands for Structured Query Language sometimes pronounced sequel a very-high-level (declarative) language user specifies what is wanted, not how to find it number of standards original ANSI SQL updated

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

Relational data model

Relational data model Relational data model Iztok Savnik FAMNIT, 18/19 Why Study the Relational Model? Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. Legacy systems in older models E.G., IBM

More information

MySQL. A practical introduction to database design

MySQL. A practical introduction to database design MySQL A practical introduction to database design Dr. Chris Tomlinson Bioinformatics Data Science Group, Room 126, Sir Alexander Fleming Building chris.tomlinson@imperial.ac.uk Database Classes 24/09/18

More information

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered

More information

The Relational Model. Relational Data Model Relational Query Language (DDL + DML) Integrity Constraints (IC)

The Relational Model. Relational Data Model Relational Query Language (DDL + DML) Integrity Constraints (IC) The Relational Model Relational Data Model Relational Query Language (DDL + DML) Integrity Constraints (IC) Why Study the Relational Model? Most widely used model in Commercial DBMSs: Vendors: IBM, Microsoft,

More information

Chapter-14 SQL COMMANDS

Chapter-14 SQL COMMANDS Chapter-14 SQL COMMANDS What is SQL? Structured Query Language and it helps to make practice on SQL commands which provides immediate results. SQL is Structured Query Language, which is a computer language

More information

Tables From Existing Tables

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

More information

Information Systems Engineering. SQL Structured Query Language DDL Data Definition (sub)language

Information Systems Engineering. SQL Structured Query Language DDL Data Definition (sub)language Information Systems Engineering SQL Structured Query Language DDL Data Definition (sub)language 1 SQL Standard Language for the Definition, Querying and Manipulation of Relational Databases on DBMSs Its

More information

SQL Introduction. CS 377: Database Systems

SQL Introduction. CS 377: Database Systems SQL Introduction CS 377: Database Systems Recap: Last Two Weeks Requirement analysis Conceptual design Logical design Physical dependence Requirement specification Conceptual data model (ER Model) Representation

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

Database Programming with PL/SQL

Database Programming with PL/SQL Database Programming with PL/SQL 2-3 Objectives This lesson covers the following objectives: Define data type and explain why it is needed List and describe categories of data types Give examples of scalar

More information

Relational Database Systems Part 01. Karine Reis Ferreira

Relational Database Systems Part 01. Karine Reis Ferreira Relational Database Systems Part 01 Karine Reis Ferreira karine@dpi.inpe.br Aula da disciplina Computação Aplicada I (CAP 241) 2016 Database System Database: is a collection of related data. represents

More information

SQL Constraints and Triggers

SQL Constraints and Triggers SQL Constraints and Triggers Dr Paolo Guagliardo University of Edinburgh Fall 2016 This page is intentionally left blank Basic SQL constraints We have already seen: UNIQUE to declare keys NOT NULL to disallow

More information

SQL DATA DEFINITION: KEY CONSTRAINTS. CS121: Relational Databases Fall 2017 Lecture 7

SQL DATA DEFINITION: KEY CONSTRAINTS. CS121: Relational Databases Fall 2017 Lecture 7 SQL DATA DEFINITION: KEY CONSTRAINTS CS121: Relational Databases Fall 2017 Lecture 7 Data Definition 2 Covered most of SQL data manipulation operations Continue exploration of SQL data definition features

More information

Chapter 8 SQL-99: Schema Definition, Basic Constraints, and Queries

Chapter 8 SQL-99: Schema Definition, Basic Constraints, and Queries Copyright 2004 Pearson Education, Inc. Chapter 8 SQL-99: Schema Definition, Basic Constraints, and Queries Copyright 2004 Pearson Education, Inc. 1 Data Definition, Constraints, and Schema Changes Used

More information

SQL: Part II. Announcements (September 18) Incomplete information. CPS 116 Introduction to Database Systems. Homework #1 due today (11:59pm)

SQL: Part II. Announcements (September 18) Incomplete information. CPS 116 Introduction to Database Systems. Homework #1 due today (11:59pm) SQL: Part II CPS 116 Introduction to Database Systems Announcements (September 18) 2 Homework #1 due today (11:59pm) Submit in class, slide underneath my office door Sample solution available Thursday

More information

Introduction to Data Management. Lecture #4 (E-R Relational Translation)

Introduction to Data Management. Lecture #4 (E-R Relational Translation) Introduction to Data Management Lecture #4 (E-R Relational Translation) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v Today

More information

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

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

More information

SQL Data Definition and Data Manipulation Languages (DDL and DML)

SQL Data Definition and Data Manipulation Languages (DDL and DML) .. Cal Poly CPE/CSC 365: Introduction to Database Systems Alexander Dekhtyar.. SQL Data Definition and Data Manipulation Languages (DDL and DML) Note: This handout instroduces both the ANSI SQL synatax

More information

Constraints. Local and Global Constraints Triggers

Constraints. Local and Global Constraints Triggers Constraints Foreign Keys Local and Global Constraints Triggers 1 Constraints and Triggers A constraint is a relationship among data elements that the DBMS is required to enforce. Example: key constraints.

More information

Lecture 5: SQL s Data Definition Language

Lecture 5: SQL s Data Definition Language Lecture 5: SQL s Data Definition Language CS1106/CS5021/CS6503 Introduction to Relational Databases Dr Kieran T. Herley Department of Computer Science University College Cork 2017-2018 KH (29/09/17) Lecture

More information

Data Definition and Data Manipulation. Lecture 5: SQL s Data Definition Language CS1106/CS5021/CS6503 Introduction to Relational Databases

Data Definition and Data Manipulation. Lecture 5: SQL s Data Definition Language CS1106/CS5021/CS6503 Introduction to Relational Databases and Data Manipulation Lecture 5: SQL s Language CS1106/CS5021/CS6503 Introduction to Relational Databases Dr Kieran T Herley Department of Computer Science University College Cork 2017-2018 So far we ve

More information

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

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

More information

SQL Interview Questions

SQL Interview Questions SQL Interview Questions SQL stands for Structured Query Language. It is used as a programming language for querying Relational Database Management Systems. In this tutorial, we shall go through the basic

More information

Fundamentals, Design, and Implementation, 9/e Copyright 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e by David M.

Fundamentals, Design, and Implementation, 9/e Copyright 2004 Database Processing: Fundamentals, Design, and Implementation, 9/e by David M. Chapter 5 Database Design Elements of Database Design Fundamentals, Design, and Implementation, 9/e Chapter 5/2 The Database Design Process Create tables and columns from entities and attributes Select

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lecture 16: Constraints CSE 344 - Fall 2014 1 Announcements Sections tomorrow: XML. Quiz and next HW on XML posted soon, due next week after midterm HW 4 due tomorrow

More information

Database Management Systems. Chapter 3 Part 1

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

More information

Sql Server Syllabus. Overview

Sql Server Syllabus. Overview Sql Server Syllabus Overview This SQL Server training teaches developers all the Transact-SQL skills they need to create database objects like Tables, Views, Stored procedures & Functions and triggers

More information

SQL: Part II. Introduction to Databases CompSci 316 Fall 2018

SQL: Part II. Introduction to Databases CompSci 316 Fall 2018 SQL: Part II Introduction to Databases CompSci 316 Fall 2018 2 Announcements (Thu., Sep. 20) Homework #1 sample solution to be posted on Sakai by this weekend Homework #2 due in 1½ weeks Get started on

More information

Lecture 08. Spring 2018 Borough of Manhattan Community College

Lecture 08. Spring 2018 Borough of Manhattan Community College Lecture 08 Spring 2018 Borough of Manhattan Community College 1 The SQL Programming Language Recent versions of the SQL standard allow SQL to be embedded in high-level programming languages to help develop

More information

ENHANCING DATABASE PERFORMANCE

ENHANCING DATABASE PERFORMANCE ENHANCING DATABASE PERFORMANCE Performance Topics Monitoring Load Balancing Defragmenting Free Space Striping Tables Using Clusters Using Efficient Table Structures Using Indexing Optimizing Queries Supplying

More information

Chapter 8: Working With Databases & Tables

Chapter 8: Working With Databases & Tables Chapter 8: Working With Databases & Tables o Working with Databases & Tables DDL Component of SQL Databases CREATE DATABASE class; o Represented as directories in MySQL s data storage area o Can t have

More information

ITCS 3160 DATA BASE DESIGN AND IMPLEMENTATION

ITCS 3160 DATA BASE DESIGN AND IMPLEMENTATION ITCS 3160 DATA BASE DESIGN AND IMPLEMENTATION JING YANG 2010 FALL Class 3: The Relational Data Model and Relational Database Constraints Outline 2 The Relational Data Model and Relational Database Constraints

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

Downloaded from

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

More information

CSE 530A. Inheritance and Partitioning. Washington University Fall 2013

CSE 530A. Inheritance and Partitioning. Washington University Fall 2013 CSE 530A Inheritance and Partitioning Washington University Fall 2013 Inheritance PostgreSQL provides table inheritance SQL defines type inheritance, PostgreSQL's table inheritance is different A table

More information