1 Database Systems Basic SQL. 2Outline  SQL Data Definition and Data Types  Specifying Constraints in SQL  Basic Retrieval Queries in SQL  INSERT,

Slides:



Advertisements
Similar presentations
SQL DESIGN AND IMPLEMENTATION CONTENT SOURCES: ELAMSARI AND NAVATHE, FUNDAMENTALS OF DATABASE MANAGEMENT SYSTEMSELAMSARI AND NAVATHE, FUNDAMENTALS OF.
Advertisements

Relational Database. Relational database: a set of relations Relation: made up of 2 parts: − Schema : specifies the name of relations, plus name and type.
OUTLINE OF THE LECTURE PART I GOAL: Understand the Data Definition Statements in Fig 4.1 Step1: Columns of the Tables and Data types. Step2: Single column.
Basic Queries. 2 Retrieval Queries in SQL SQL has one basic statement for retrieving information from a database; the SELECT statement This is not the.
Displaying Data from Multiple Tables. EMPNO DEPTNO LOC NEW YORK CHICAGO NEW YORK DALLAS
Database technology Lecture 2: Relational databases and SQL
Database Design -- Basic SQL
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 8- 1.
1 CSE 480: Database Systems Lecture 10: SQL - DML Reference: Read Chapter 4 of the textbook.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 SQL: Data Definition, Constraints, and Basic Queries and Updates.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 8 SQL-99: SchemaDefinition, Constraints, and Queries and Views.
Introduction to Structured Query Language (SQL)
CS 104 Introduction to Computer Science and Graphics Problems Introduction to Database (2) Basic SQL 12/05/2008 Yang Song.
SQL The relational DB Standard CS-450 Dr. Ali Obaidi.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 8- 1 CREATE/DROP/ALTER TABLE Data types : char, varchar, decimal, date CREATE TABLE DEPARTMENT.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 Basic SQL.
Al-Imam University Girls Education Center Collage of Computer Science 1 ST Semester, 1432/1433H Chapter 8 Part 4 SQL-99 Schema Definition, Constraints,
CSE314 Database Systems Lecture 4 Basic SQL Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Ms. Hatoon Al-Sagri CCIS – IS Department SQL-99 :Schema Definition, Constraints, Queries, and Views 1.
1 CS 430 Database Theory Winter 2005 Lecture 12: SQL DML - SELECT.
1 CSE 480: Database Systems Lecture 11: SQL. 2 SQL Query SELECT FROM WHERE –In MySQL, FROM and WHERE clauses are optional –Example:
SQL: Schema Definition, Constraints, & Queries and Views.
Relational Algebra - Chapter (7th ed )
Onsdag The concepts in a relation data model SQL DDL DML.
SQL: DDL John Ortiz Cs.utsa.edu.
Announcements Written Homework 1 due Friday –If you have fourth edition make sure you do the right problems Program 3 out today, due next Friday Nov 10.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
莊裕澤資料庫基本概念 1 Yuh-Jzer Joung 莊 裕 澤 Dept. of Information Management National Taiwan University February, 2002 資料庫管理與資訊科技.
SQL Chapter 8. SQL or SEQUEL - (Structured English Query Language) Based on relational algebra Developed in 1970's released in early 1980's Standardized.
Chapter 7 SQL HUANG XUEHUA. AGGREGATE FUNCTIONS Include COUNT, SUM, MAX, MIN, and AVG Query 15: Find the maximum salary, the minimum salary, and the.
Chapter 8 Part 2 SQL-99 Schema Definition, Constraints, Queries, and Views.
Prince Sultan University Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Slide 8- 1 THE HAVING-CLAUSE Provides a condition on the summary information Sometimes we want to retrieve the values of these functions for only those.
Structured Query Language
CMPT 258 Database Systems The Relationship Model (Chapter 3)
Week 8-9 SQL-1. SQL Components: DDL, DCL, & DML SQL is a very large and powerful language, but every type of SQL statement falls within one of three main.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 6 Basic SQL Slide 6- 1.
Constraints and Views Chap. 3-5 continued (7 th ed. 5-7)
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 (SQL Basics) Lecture # 9 July 7,2012.
1 COMP 1100 Basic SQL David J. Stucki. Outline SQL Overview Retrievals Schema creation Table creation Constraints Inserts Updates 2.
Copyright © 2004 Pearson Education, Inc. Schema Definition, Basic Constraints, and Queries.
SQL- Updates, Assertions and Views. Data Definition, Constraints, and Schema Changes Used to CREATE, DROP, and ALTER the descriptions of the tables (relations)
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 Basic SQL تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 Basic SQL تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة.
CS580 Advanced Database Topics Chapter 8 SQL Irena Pevac.
1 Chapter (8) SQL The Relational Database Standard Objectives Presenting the main features of SQL SQL is the Structured Query Language SQL commands SQL.
The SQL Database Grammar
CHAPTER 6 Basic SQL. CHAPTER 6 Basic SQL Chapter 6 Outline SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries.
SQL: SchemaDefinition, Constraints, and Queries and Views
Chapter 4 Basic SQL.
CS580 Advanced Database Topics
Database Systems Basic SQL
Retrieval Queries in SQL(DML)
Subject Name: DATA BASE MANAGEMENT SYSTEM Subject Code: 10cs54
376a. Database Design Dept. of Computer Science Vassar College
11/9/2018.
Chapter 4 Basic SQL. Chapter 4 Basic SQL Chapter 4 Outline Overview of SQL SQL Data Definition (DDL) for Specifying a Relational Database Schema CREATE.
SQL (more).
SQL-1 Week 8-9.
Structured Query Language (3)
SQL-99: Schema Definition, Constraints, and Queries and Views
ISC321 Database Systems I Chapter 4: SQL: Data definition, Constraints, and Basic Queries and Updates Fall 2015 Dr. Abdullah Almutairi.
SQL Updating Database Contents Presented by: Dr. Samir Tartir
SQL Grouping, Ordering & Arithmetics Presented by: Dr. Samir Tartir
Presentation transcript:

1 Database Systems Basic SQL

2Outline  SQL Data Definition and Data Types  Specifying Constraints in SQL  Basic Retrieval Queries in SQL  INSERT, DELETE, and UPDATE Statements in SQL  Additional Features of SQL

3 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, and updates (both DDL and DML)  SQL is not a programming language.  SQL commands can be used interactively as a query language within the DBMS or SQL commands can be embedded within programming languages.

4 Types of SQL Commands  Data Definition Language (DDL):  Commands that define a database - Create, Alter, Drop  Data Manipulation Language (DML)  Commands that maintain and query a database.  Each statement in SQL ends with a semicolon

5 SQL ConceptRelational Concept TableRelation RowTuple Column Attribute SQL Concept & Relational Concept  Terminology:  Table, row, and column used for relational model terms relation, tuple, and attribute

6 The CREATE TABLE Command   CREATE statement  Main SQL command for data definition  Specify a new relation  Provide name  Specify attributes and initial constraints   Base tables (base relations)  Relation and its tuples are actually created and stored as a file by the DBMS

7 The CREATE TABLE Command   Can optionally specify schema:  CREATE TABLE COMPANY.EMPLOYEE... or  CREATE TABLE EMPLOYEE...   Create the following relation:  Student(SSN, Name, GPA, Age).   SQL> create table Student ( 2SSNchar(9) not null, 3Name varchar(20), 4GPA number(3,2), 5Age number(2), 6primary key (SSN));

8

9

10 Attribute Data Types  fixed length character string of length n  char(n) fixed length character string of length n  variable length characters of length up to n  varchar(n) variable length characters of length up to n  integer and real values of up to n digits  number(n) integer and real values of up to n digits  integer and real values of up to 40 digits  number integer and real values of up to 40 digits  integer of up to n digits  integer(n) integer of up to n digits  integer of up to 40 digits  integer integer of up to 40 digits  yyyy-mm-dd (10 positions)  date yyyy-mm-dd (10 positions)  typically in the form HH:MM:SS  time typically in the form HH:MM:SS

11 Domain Definitions   CREATE DOMAIN As ;  CREATE DOMAIN SSN-TYPE AS CHAR(9);  We can use SSN_TYPE in place of CHAR(9)  This style in writing SQL statements is preferred as it makes it easier to change the data types of attributes.   A domain can also have an optional default specification via default clause.  CREATE DOMAIN DNO-DOM AS CHAR(2) DEFAULT 01;

12 Specifying Constraints in SQL  Constraints are rules or regulations imposed on data to ensure their integrity and correctness.  Constraints on individual columns.  Constraints on a table.  Constraints on multiple tables.

13 Constraints on Columns (1) Create table Book( ISBN char(15) primary key, Title varchar(50) unique, Price number(5,2) check (Price>0), Edition number(2) default 1 check (Edition > 0), Publisher_name varchar(30) references Publisher(Name));

14 Constraints on Individual Columns (2)  typevalues must be of the given type  not nullno null value can be taken  unique  Specifies alternate (secondary) keys  Dname VARCHAR(15) UNIQUE;  no identical non-null values  primary key  Specifies one or more attributes that make up the primary key of a relation  no null value and no identical values  Dnumber INT PRIMARY KEY;  check constraint definition  values must satisfy the check condition.  Dnumber INT NOT NULL CHECK (Dnumber > 0 AND Dnumber < 21);

15 Constraints on Individual Columns (3)  Syntax for column definition: col_name data_type [default value] [constraints]  Syntax for column constraints: [constraint constraint_name] [not] null | check condition | unique | primary key | references table_name [(column)] [on delete cascade] [on update cascade]

16 Create Table Example (4) Create table Enrollment( SSN char(9) references Students, Crs_no varchar(7) not null, Section_no number(2) not null, Grade char, primary key(SSN,Crs_no,Section_no), foreign key (Crs_no,Section_no) references Section);

17 Giving Names to Constraints  Syntax for table constraints: [constraint constraint_name] check condition | unique (column {, column}) | primary key (column {, column}) | foreign key (column {, column}) references table_name[(column{, column)]  CHECK clauses at the end of a CREATE TABLE statement  Apply to each tuple individually  CHECK (Dept_create_date <= Mgr_start_date);

18 Giving Names to Constraints Create table Graduate( SSN char(9) primary key, Name varchar(30), Address varchar(80), Degree varchar(8) check (Degree in {‘Bachelor’, ‘Master’, ‘Ph.D.’}), GPA number (3,2) not null, unique (Name, Address), constraint ic12 check (GPA>=2.0 and (Degree=‘Bachelor’ or GPA>=3.0)));

19 Disabling and Enabling a Constraint  Disabling a constraint:  alter table Graduate disable constraint ic12;  Enabling a constraint:  alter table Graduate enable constraint ic12;

20 Basic Retrieval Queries in SQL  SELECT statement  One basic statement for retrieving information from a database

21 The SELECT-FROM-WHERE  Basic form of the SELECT statement:

22 The SELECT-FROM-WHERE Structure  Logical comparison operators  =,, >=, and <>  Projection attributes  Attributes whose values are to be retrieved  Selection condition  Boolean condition that must be true for any retrieved tuple

23

24

25 The SELECT-FROM-WHERE   Find the SSN, Name and GPA of all students whose GPA is higher than 3.8. Select SSN, Name, GPA From Students Where GPA > 3.8;   Select all EMPLOYEE SSNs. SELECT SSN FROM EMPLOYEE;   Select all combinations of Employee SSNs and Department Dname. SELECT SSN, DNAME FROM EMPLOYEE, DEPARTMENT;

26 The SELECT-FROM-WHERE   Select all attributes of employees who work for department number 5; SELECT * FROM EMPLOYEE WHERE DNO = 5;   Find the names and GPAs of all students who take database systems. Select Name, GPA From Student, Enrollment, Course Where Title = `database systems` and Students.SSN = Enrollment.SSN and Enrollment.Course_no=Courses.Course_no;

27 Ambiguous Attribute Names  Same name can be used for two (or more) attributes  As long as the attributes are in different relations  Must qualify the attribute name with the relation name to prevent ambiguity EMPLOYEE(SSN, Name, …., DNo) DEPARTMENT(DNo, Name, …)

28 Aliasing, Renaming, and Tuple Variables  Aliases or tuple variables  Declare alternative relation names E and S  EMPLOYEE AS E(Fn, Mi, Ln, Ssn, Bd, Addr, Sex, Sal, Sssn, Dno)

29 Dealing with Aliasing (1)   For each employee retrieve the employee’s first and last name and the first and last name of his or her immediate advisor. SELECT E.Fname, E.Lname, S.Fname, S.Lname FROM Employee E, Employee S WHERE E.SuperSSN = S.SSN;   We may write Employee AS E   Note that aliases can be used to shorten queries by giving short names to relations.

30 Dealing with Aliasing (2)   We may alias attributes as well.   Employee(Name, Address, Supervisor, Dept)   Q1:  Select NA, Adr, S, Dept FROM EMPLOYEE AS E(NA, Adr, S, D)   Or this  Select Name NA, Address adr, Supervisor S, Dept D FROM EMPLOYEE;   Find the names and GPAs of all students who take database systems. Select Name, GPA From Student S, Enrollment E, Course C Where Title=`database systems‘ and S.SSN=E.SSN and E.Course_no=C.Course_no

31 Dealing with Aliasing (3)   Find all pairs of students who have the same GPA. select s1.SSN, s2.SSN from Student s1, Student s2 where s1.GPA=s2.GPA and s1.SSN<s2.SSN;   Question:  Why use “s1.SSN < s2.SSN”?

32 Dealing with Aliasing (4)   Find the names of all students whose GPA is higher than Tom's GPA. select s1.Name from Students s1, Students s2 where s2.Name=‘Tom’ and s1.GPA>s2.GPA ;

33 Renaming SELECT Attributes   SQL allows us to rename SELECT attributes   This does not significantly change the results of a query, but it does allow us to control the headings of the columns displayed on reports SELECT FNAME AS FN, LNAME AS LN FROM EMPLOYEE WHERE SUPERSSN IS NULL   The same tuples will be selected as for the last query, but now the columns will be labeled FN and LN instead of FNAME and LNAME.

34 Unspecified WHERE Clause and Use of the Asterisk  Missing WHERE clause  Indicates no condition on tuple selection  CROSS PRODUCT  All possible tuple combinations

35 Unspecified WHERE Clause and Use of the Asterisk (cont’d.)  Specify an asterisk (*)  Retrieve all the attribute values of the selected tuples

36 Unspecified Where Clause & Use of Asterisk   To retrieve all attributes of a relation, use the shorthand *  To retrieve all the attribute values of the selected tuples, a * is used, which stands for all the attributes   Find all students whose GPA is higher than 3.8. select * from Students where GPA > 3.8;   The where-clause may be absent.  Find the Names of all students. select Name from Students;  Select all EMPLOYEE SSNs. SELECT SSN FROM EMPLOYEE;

37 Unspecified Where clause   A missing WHERE-clause indicates no condition; hence, all tuples of the relations in the FROM-clause are selected   This is equivalent to the condition WHERE TRUE   Retrieve the SSN values for all employees. SELECT SSN FROMEMPLOYEE;   If more than one relation is specified in the FROM-clause and there is no join condition, then the CARTESIAN PRODUCT of tuples is selected

38 Use of Asterisk   Retrieve all the attributes of an employee and the attributes of the department he/she works in for every employee of the “Research” department. SELECT * FROM Employee, Department WHERE Dname = “Research” AND DNO = Dnumber;   Specify (retrieve) the cross product of the Employee and Department relations; SELECT * FROM Employee, Department;   Select all combinations of Employee SSNs and Department Dname. SELECT SSN, DNAME FROM EMPLOYEE, DEPARTMENT;

39 Tables as Sets in SQL  SQL does not automatically eliminate duplicate tuples in query results  Use the keyword DISTINCT in the SELECT clause  Only distinct tuples should remain in the result   Find the Names of all students without duplicate rows. Select distinct Name from Student;   Select all can be used to explicitly request that all duplicate rows are kept.   Is the following query an efficient query? select distinct SSN, Name from Student   Retrieve the salary for every employee.  duplicates may appear SELECT Salary FROM Employee ;  duplicates will be eliminated SELECT DISTINCT Salary FROM Employee;

40 Tables as Sets in SQL (cont’d.)  Set operations  UNION, EXCEPT (difference), INTERSECT  Corresponding multiset operations: UNION ALL, EXCEPT ALL, INTERSECT ALL )  union removes duplicate rows.  union all keeps duplicate rows.

41 Substring Pattern Matching and Arithmetic Operators  LIKE comparison operator  Used for string pattern matching  % replaces an arbitrary number of zero or more characters  underscore (_) replaces a single character  Standard arithmetic operators:  Addition (+), subtraction (–), multiplication (*), and division (/)  BETWEEN comparison operator

42 Substring Pattern Matching   Find the course numbers and titles of all courses whose title contains “systems”. select Course_no, Title from Courses where Title like `%systems%`;   % matches 0 or more characters.

43 Substring Pattern Matching   Find all students whose name starts with M and is six-character long. select * from Students where Name like `M_ _ _ _ _`;   _ matches exactly one character   not like is the opposite of like.   Find all students whose name contains a _. select * from Students where Name like `%\_ %`;

44 Substring Pattern Matching   Retrieve all employees whose address in Housten, Texas. SELECT Fname, Lname FROM Employee WHERE Address LIKE ’%Houston, TX%’;   Find all employees who were born during the 1950s. SELECT Fname, Lname FROM Employee WHERE Bdate LIKE ’ 195_ _ _ _ _ ’ ;

45 Arithmetic Operators   Show resulting salaries if every employee working on the ‘productX’ project is given a 10% raise. SELECT Fname, Lname, 1.1*Salary FROM Employee, Works_on, Project WHERE SSN = ESSN AND PNO = Pnumber AND Pname=“ProductX”;   Find the names of all students whose GPA is between 3.5 and 3.8, inclusive. select Name from Students where GPA between 3.5 and 3.8;   not between... and … is the opposite of between … and...

46 Arithmetic Operators   Employees (SSN, Name, Salary)   Find the SSN, name and annual salary of each employee. select SSN, Name, 12*Salary from Employees; or select SSN, Name,12*Salary as Annual_Salary from Employees;

47 Ordering of Query Results  Use ORDER BY clause  Keyword DESC to see result in a descending order of values  Keyword ASC to specify ascending order explicitly  ORDER BY D.Dname DESC, E.Lname ASC, E.Fname ASC

48 Ordering Tuples   Find the names of all students and order the names in ascending order. select Name from Students order by Name asc;   ascending order is the default in order by clause.   We can write: order by Dname desc, Lname ASC, Fname ASC

49 Ordering Tuples   Find all the students whose GPA is higher than 3.5 and order the result in descending order by GPA, and for students having the same GPA, order them in ascending order by their names. select * from Students where GPA > 3.5 order by GPA desc, Name asc;

50 Ordering Tuples   Retrieve a list of employees and the projects they are working on, ordered by department and, within each department, alphabetically by last name, first name; SELECT Dname, Lname, Fname, Pname FROM Department, Employee, Works_on, Project WHERE Dnumber=DNO AND SSN=ESSN AND PNO=Pnumber ORDER BY Dname, Lname, Fname;

51 Discussion and Summary of Basic SQL Retrieval Queries

52 INSERT, DELETE, and UPDATE Statements in SQL  Three commands used to modify the database:  INSERT, DELETE, and UPDATE   Relation schemas under consideration:  Student(SSN, Name, GPA, Age)  Course(CNo, Title, DName)  Enrollment(SSN, CNo, Grade)

53 The INSERT Command  Specify the relation name and a list of values for the tuple

54Insert   In its simplest form, it is used to add one or more tuples to a relation   Attribute values should be listed in the same order as the attributes were specified in the CREATE TABLE command.   Syntax: insert into table_name [(column {, column})] [values (expression {, expression})] | [Subselect]   Multiple tuples can be inserted with the same INSERT command, tuples are separated by commas and enclosed between ( and ).

55 Insert   Add a new student (123, Ali, null, 22) to the student table Student(SSN, Name, GPA, Age). insert into Students values (`123`,`Ali`,null,22);  Order of values should agree with the original definition of Student.   or insert into student(name, ssn, age) values (`Ali`,`123`,22)   Attributes with NULL and DEFAULT values can be left out.

56 Insert   Insert two tuples into the Students table insert into Students values (‘ ’, ‘Smith’, 3.45, 23) (‘ ’, ‘Maria’, 3.60, 22);   Suppose table Top_Students (SSN, Name, GPA) has been created.   Find all students whose GPA is 3.8 or higher and save the result in the Top_Students table. insert into Top_Students select SSN, Name, GPA from Student where GPA >= 3.8;

57 Insert CREATE TABLE DEPTS-INFO( DNAMEVARCHAR(15), NO-OF-EMPSINTEGER, TOTTAL-SALINTEGER); INSERT INTO DEPTS-INFO (DNAME, NO-OF-EMPS, TOTAL-SAL) SELECT DNAME, count(*), sum(SALARY) FROM DEPARTMENT, EMPOYEE WHERE DNUMBER = DNO GROUP BY DNAME;

58 INSERT INTO COURSE (COURSE_CODE, CREDIT_HOURS) VALUES (‘MIS499’,4); INSERT INTO COURSE VALUES (‘MIS499’,’’,4); INSERT INTO COURSE VALUES (‘MIS499’,NULL,4); COLUMN LIST IS NEEDED IF YOU PLAN TO LEAVE OUT A VALUE IN THE VALUE LIST COLUMN LIST CAN BE OMITTED IF YOU PUT IN A BLANK VALUE THE NULL KEYWORD CAN BE USED TO CREATE A BLANK COLUMN ALL OF THESE ASSUME THAT THE DATABASE ALLOWS THE COLUMN TO BE NULL. YOU CANNOT LEAVE PRIMARY KEYS BLANK Inserting Null Data

59 Delete   Removes tuples from a relation   Includes a WHERE-clause to select the tuples to be deleted   Tuples are deleted from only one table at a time (unless CASCADE is specified on a referential integrity constraint)   A missing WHERE-clause specifies that all tuples in the relation are to be deleted; the table then becomes an empty table   The number of tuples deleted depends on the number of tuples in the relation that satisfy the WHERE-clause   Referential integrity should be enforced

60 Delete   Syntax: delete from table_name [where search_condition]   Delete all tuples from Students. delete from Students;   The schema of Students remains.   Delete all students who take no courses. delete from Students where SSN not in (select SSN from Enrollment);

61 The DELETE Command  Removes tuples from a relation  Includes a WHERE clause to select the tuples to be deleted

62 Delete DELETE FROM Employee WHERE Lname = ‘Brown’; DELETE FROM Employee where SSN = ‘ ’ DELETE FROM EMPLOYEE WHERE DNO IN (SELECT Dnumber FROM Department WHERE Dname = ‘Research’);

63 Update   Used to modify attribute values of one or more selected tuples   A WHERE-clause selects the tuples to be modified   An additional SET-clause specifies the attributes to be modified and their new values   Each command modifies tuples in the same relation   Referential integrity should be enforced   Syntax: update table_name set column = {expression | null} {, column = {expression | null}} [where search_condition]

64 Update   Increase the GPA of the student with SSN=123 by 0.5. update Student set GPA = GPA where SSN = '123';   Set the Grade of every student who takes database systems to be A. update Enrollment set Grade = 'A' where CNo in (select CNo from Course where title='database systems');

65 Update   Change the location and controlling department number of project number 10 to 'Bellaire' and 5, respectively. UPDATE Project SET Plocation = ‘Bellaire’, Dnum = 5 WHERE Pnumber=10;   Give all employees in the 'Research' department a 10% raise in salary. UPDATE Employee SET Salary = Salary * 1.1 WHERE DNO IN (SELECT Dnumber FROM Department WHERE Dname = ‘Research’);

66 The UPDATE Command  Modify attribute values of one or more selected tuples  Additional SET clause in the UPDATE command  Specifies attributes to be modified and new values