Basic SQL Flashcards

1
Q

SQL stands for

A

Structured Query Language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

SQL is a comprehensive database language, meaning

A

It has statements for data definitions, queries, and updates

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

DDL stands for

A

Data Definition Language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

DML stands for

A

Data Manipulation Language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

SQL standards are divided into

A

Core specification PLUS specialized extensions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

SQL core

A

supposed to be implemented by all RDBMS veodors that are SQL complaint

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

SQL extensions

A

can be implemented as optional modules to be purchased independently for specific DB applications such as data mining, spatial data, temporal data, data warehousing, online analytical processing, etc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Table row and column correspond to relational model terms

A

relation, tuple, attribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

CREATE statement can create

A

schemas, tables, domains, as well as views, assertions, triggers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

SQL schema is

A

a DB structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

SQL schema is identified by

A

schema name, and includes authorization identifier to indicate the user or account who owns the schema, as well as descriptors for each element in the schema

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Schema elements include

A

tables, constraints, views, domains, and other constructs (authorization grants) that describe the schema

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to create schema (2 ways)

A

CREATE schema statement that can include all schema element definitions

Can be assigned name and authorization identifier and the elements can be defined later

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Create schema called COMPANY owned by user with authorization identifier Jsmith

A

CREATE SCHEMA COMPANY AUTHORIZATION ‘Jsmith’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

catalog

A

collection of schemas in SQL environment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

SQL environemnt

A

installation of an SQL-compliant RDBMS on a computer system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

a catalog always contains a special schema called

A

INFORMATION_SCHEMA

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

INFORMATION_SCHEMA provides

A

information on all the schemas in the catalog and all the element descriptors in these schemas

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

CREATE TABLE command used for

A

specify new relation by giving it name and specifying its attributes and initial constraints

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Order how attributes are specified when creating table

A

attribute name, data type to specify domain of values, any constraints (NOT NULL)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

When are key, entity integrity, and referential integrity constraints specified

A

within CREATE TABLE statement after the attributes are declared or can be added later using the ALTER TABLE command

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

can explicitly attach schema name to relation name, separated by a period

A

CREATE TABLE COMPANY.EMPLOYEE rather than CREATE TABLE EMPLOYEE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

base relations are created through

A

CREATE TABLE statements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

base relations

A

relation and its tuples are created and stored as a file by the DBMS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

virtual relations

A

created through CREATE VIEW statement, which may or may not correspond to an actual physical file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

attributes in base table considered to be ordered

A

in sequence in which they are specified in the CREATE TABLE statement, but rows aren’t considered to be ordered within a relation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Example code of creating a table

A
CREATE TABLE DEPARTMENT
( Dnam VARCHAR(15) NOT NULL,
Number INT NOT NULL,
Mgr_ssn CHAR(9) NOT NULL, 
Mgr_start_date DATE,
PRIMARY KEY (Dnumber),
UNIQUE (Dname), 
FOREIGN KEY (Mgr_ssn) REFERENCES EMPLOYEE (Ssn) );
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

basic data types available for attributes

A

numeric, character, string, bit string, Boolean, date, time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Numeric datatypes include

A

Integer numbers: INT, and floating point (real) numbers: FLOAT, REAL, DOUBLE PRECISION), DECIMAL,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

DECIMAL(i,j)… what does I and J stand for

what would DECIMAL(5,2) mean

A

i is the precision (total number of decimal digits)
j is the scale (number of digits after the decimal point) -default zero

3 digits before the decimal, 2 after decimal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

Character string data types

A

CHAR, VARCHAR, CLOB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

CHAR(n)

A

fixed length… n is the number of characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

If value of Smith for an attribute of type CHAR(10)

A

it’s padded with 5 blank characters to become ‘Smith ‘

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

VARCHAR(n)

A

varying length. n is number of max characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

if str1 comes before str2 in alphabetic order it is considered

A

to be less than str2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

concatenation of strings

A

‘abc’ || ‘XYZ’ results in a single string ‘abcXYZ’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

CLOB (CHARACTER LARGE OBJECT)

A

specify columns that have large text values, such as documents. CLOB maximum length can be specified in kilobytes (K), megabytes (M), or gigabytes (G)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

CLOB(20M) specifies

A

maximum length of 20 megabytes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

bit-string data

A

either of fixed length n—BIT(n)—or varying length—BIT VARYING(n), where n is the maximum number of bits

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

write an example of a bit string

A

Literal bit strings are placed between single quotes but preceded by a B to distinguish
them from character strings; for example, B‘10101’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

BLOB

A

BINARY LARGE OBJECT
specify columns that have large binary values, such as images
can be specified in kilobits (K), megabits (M), or gigabits (G)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

BLOB(30G)

A

specifies a maxi- mum length of 30 gigabits

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

Boolean

A

TRUE/FALSE/UNKNOWN (because SQL has 3valued logic)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

DATE number of position

A

10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

date components

A

YYYY-MM-DD

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

TIME number positions

A

> =8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

time components

A

HH:MM:SS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

comparison with dates and time

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

Literal date values represented by

A

DATE ‘2008-09-27’ or TIME ‘09:12:47’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

Domain can be declared and domain name used with the attribute specification. show:

A

CREATE DOMAIN SSN_TYPE AS CHAR(9);

Can use SSN_TYPE in place of CHAR(9) when defining table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

NOT NULL

A

may be specified if NULL is not permitted for a particular attribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

primary keys required not to

A

be null

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

How to define default value for an attribute

A

append the clause DEFAULT to attribute definition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

default value included in any new tuple if

A

explicit value not provided for that tattribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

if no default clause specified

A

default value is null for attributes that don’t have a NOT NULL constraint

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q

Example of setting default for attribute

A

Dno INT NOT NULL DEFAULT 1,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q

CHECK clause

A

can restrict attribute or domain values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q

CHECK clause… department numbers are restricted to integer numbers between 1 and 20

A

Number INT NOT NULL CHECK (Dnumber >0 AND Dnumber

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q

check clause can also be used with create domain statement.e example

A

CREATE DOMAIN D_NUM AS INTEGER

CHECK (D_NUM >0 AND D_NUM

60
Q

Primary key clause

A

specifies 1+ attributes that make up primary key of relation

61
Q

Unique clause

A

specifies alternate (secondary) keys

62
Q

referential integrity specified via

A

FOREIGN KEY clause

63
Q

referential integrity constraint can be violated when

A

tuples are deleted/inserted, or when a foreign key or primary key attribute is modified

64
Q

default action SQL takes for integrity violations

A

reject update operation that will cause violation, known are the RESTRICT option

65
Q

referential triggered action clause

A

can be attached to any foreign key constraints to deal with referential integrity issues

66
Q

options for referential triggered action clause

A

SET NULL, CASCADE, SET DEFAULT and must be qualified with either ON DELETE or ON UPDATE

67
Q

if tuple for supervising employee is deleted, the value of Super_ssn is automatically set to NULL for all employee tuples that were referencing the deleted tuple

A

CONSTRAINT EMPSUPERFK
FOREIGN KEY (Super_ssn) REFERENCES EMPLOYEE(Ssn)
ON DELETE SET NULL ON UPDATE CASCADE,

68
Q

CONSTRAINT EMPSUPERFK
FOREIGN KEY (Super_ssn) REFERENCES EMPLOYEE(Ssn)
ON DELETE SET NULL ON UPDATE CASCADE,

if value of Ssn for supervior is updated…

A

new value is cascaded through to Super_ssn for all employee tuples referencing the updated employee tuple

69
Q

CASCADE ON DELETE

A

delete all the referencing tuples

70
Q

CASCADE ON UPDATE

A

Change the value of referencing FK attributes to the updated (new) primary key value for all the referencing tuples

71
Q

table constraints can be specified through CHECK clauses at end of CREATE TABLE statement

A

CREATE TABLE DEPARTMENT CHECK (Dept_create_date

72
Q

SQL is not a set of tuples, but

A

a multiset (bag) of tuples

73
Q

WHERE ;

A

condition is a conditional Boolean expression that identifies tuples to be retrieved by the query

74
Q

comparison operators

A

= = >

75
Q

Retrieve the birth date and address of the employee(s) whose name is ‘John B. Smith’.

A

SELECT Bdate, Address
FROM EMPLOYEE
WHERE Fname=‘John’ AND Minit=‘B’ AND Lname=‘Smith’;

76
Q

projection attributes

A

attributes specified by the SELECT clause that are to be retrieved

77
Q

selection condition

A

specified by the WHERE clause … must be true for any retrieved tuple

78
Q

iterator looping over each query

A

iterator in the SQL query ranging or looping over each individual tuple in the EMPLOYEE table and evaluating the condi- tion in the WHERE clause. Only those tuples that satisfy the condition (those tuples for which the condition evaluates to TRUE after substituting their corresponding attribute values) are selected.

79
Q

Retrieve the name and address of all employees who work for the ‘Research’ department.

A

SELECT FROM
WHERE
Fname, Lname, Address
EMPLOYEE, DEPARTMENT Dname=‘Research’ AND Dnumber=Dno;

80
Q

Join condition

A

Dnumber = Dno … combines 2 tuples, one from DEPARTMENT and one from EMPLOYEE whenever the value of Dnumber in DPARTMENT is equal to the value of Dno in EMPLOYEE

81
Q

For every project located in ‘Stafford’, list the project number, the controlling department number, and the department manager’s last name, address, and birth date.

A

SELECT FROM
WHERE
Pnumber, Dnum, Lname, Address, Bdate PROJECT, DEPARTMENT, EMPLOYEE Dnum=Dnumber AND Mgr_ssn=Ssn AND Plocation=‘Stafford’;

82
Q

when must we qualify attribute name with the relation name

A

when a multi table query refers to two or more attributes with the same name - to prevent ambiguity

83
Q

Retrieve the name and address of all employees who work for the ‘Research’ department.

WRITE AS QUALIFIED

A
SELECT
EMPLOYEE.Fname, EMPLOYEE.LName,
EMPLOYEE.Address
FROM EMPLOYEE, DEPARTMENT
WHERE DEPARTMENT.DName=‘Research’ AND DEPARTMENT.Dnumber=EMPLOYEE.Dno;
84
Q

For each employee, retrieve the employee’s first and last name and the first and last name of his or her immediate supervisor.

A

SELECT E.Fname, E.Lname, S.Fname, S.Lname FROM EMPLOYEE AS E, EMPLOYEE AS S WHERE E.Super_ssn=S.Ssn;

85
Q

How do we create an alias

A
FROM EMPLOYEE AS E
or
FROM EMPLOYEE E
or
SELECT Salary AS Sal
86
Q

Rename relation attributes within the query by giving them aliases

A

FROM EMPLOYEE AS E(Fn, Mi, Ln, Ssn, Bd, Addr, Sex, Sal, Sssn, Dno)

87
Q

SELECT E.Fname, E.Lname, S.Fname, S.Lname FROM EMPLOYEE AS E, EMPLOYEE AS S WHERE E.Super_ssn=S.Ssn;

Think of E and S as

A

two different copies of the EMPLOYEE relation; the first, E, represents employees in the role of supervisees or subordinates; the second, S, represents employees in the role of supervisors

88
Q

missing WHERE clause indicates

A

no condition on tuple selection; hence, all tuples of the relation specified in the FROM clause qualify and are selected for the query result

89
Q

Missing WHERE if more than one relation is specified in the FROM clause

A

CROSS PRODUCT—all possible tuple combinations—of these relations is selected

90
Q

Select all EMPLOYEE Ssns

A

SELECT Ssn

FROM EMPLOYEE;

91
Q

all combinations of EMPLOYEE Ssn and DEPARTMENT Dname

A

SELECT Ssn, Dname
FROM EMPLOYEE, DEPARTMENT;

we get the actual CROSS PRODUCT (except for duplicate elimination, if any)

92
Q
  • stands for
A

all the attributes

93
Q

retrieve all the attribute values of any EMPLOYEE who works in DEPARTMENT number 5

A

SELECT *
FROM EMPLOYEE
WHERE Dno=5;

94
Q

retrieves all the attributes of an EMPLOYEE and the attributes of the DEPARTMENT in which he or she works for every employee of the ‘Research’ department

A

SELECT *
FROM EMPLOYEE, DEPARTMENT
WHERE Dname=‘Research’ AND Dno=Dnumber;

95
Q

CROSS PRODUCT of the EMPLOYEE and DEPARTMENT relations

A

SELECT *

FROM EMPLOYEE, DEPARTMENT;

96
Q

A SQL table with a key is restricted to being a

A

set, since he key value must be distinct in each tuple

97
Q

If we want to eliminate duplicate tuples from result of SQL query use

A

DISTINCT in the SELECT clause, meaning that only distinct tuples should remain in the result

98
Q

Specifying SELECT with neither ALL nor DISTINCT—as in our previous examples— is equivalent to

A

SELECT ALL

99
Q

Retrieve the salary of every employee

A

SELECT ALL Salary

FROM EMPLOYEE;

100
Q

retrieve all distinct salary values

A

SELECT DISTINCT Salary

FROM EMPLOYEE;

101
Q

Set operations by SQL

A
set union (UNION)
set difference (EXCEPT)
set intersection (INTERSECT)
102
Q

relations resulting from these set operations are sets of

A

tuples. that is, duplicate tuples are eliminated from the result

103
Q

set operations apply only to

A

union-compatible relations, so we must make sure that the two relations on which we apply the operation have the same attributes and that all the attributes appear in the same order in both relations

104
Q

Make a list of all project numbers for projects that involve an employee whose last name is ‘Smith’, either as a worker or as a manager of the department that controls the project.
Using Union

A

(SELECT DISTINCT Pnumber
FROM PROJECT, DEPARTMENT, EMPLOYEE
WHERE Dnum=Dnumber AND Mgr_ssn=Ssn AND Lname=‘Smith’ )

UNION 
( SELECT DISTINCT Pnumber
FROM PROJECT, WORKS_ON, EMPLOYEE
WHERE Pnumber=Pno AND Essn=Ssn
AND Lname=‘Smith’ );
105
Q

Corresponding multiset operations

A

UNION ALL, EXCEPT ALL, INTERSECT ALL

106
Q

UNION ALL, EXCEPT ALL, INTERSECT ALL

their results are

A

multisets- duplicates not eliminated

107
Q

String pattern matching

A

comparison condition on only parts of a character string

108
Q

what to use for string pattern matching

A

LIKE or ILIKE (not case sensitive)

109
Q

Partial strings are specified using two reserved characters:

A

% replaces an arbitrary number of zero or more characters, and the underscore (_) replaces a single character.

110
Q

Retrieve all employees whose address is in Houston, Texas.

A

SELECT Fname, Lname
FROM EMPLOYEE
WHERE Address LIKE ‘%Houston,TX%’;

111
Q

Find all employees who were born during the 1950s.

A

SELECT Fname, Lname FROM EMPLOYEE

WHERE Bdate LIKE‘_ 5 _ _ _ _ _ _’;

112
Q

If an underscore or % is needed as a literal character in the string, the character should be

A

preceded by an escape character, which is specified after the string using the keyword ESCAPE.

113
Q

______represents the literal string ‘AB_CD%EF’

A

‘AB_CD\%EF’ ESCAPE ‘\’

114
Q

If an apostrophe (’) is needed, it is represented as

A

two consecutive apostrophes (”) so that it will not be interpreted as ending the string

115
Q

using arithmetic in queries … can be applied to

A

addition (+), subtraction (–), multiplication (*), and division (/) can be applied to numeric values or attributes with numeric domains

116
Q

Show the resulting salaries if every employee working on the ‘ProductX’ project is given a 10 percent raise.

A

SELECT E.Fname, E.Lname, 1.1 * E.Salary AS Increased_sal
FROM EMPLOYEE AS E, WORKS_ON AS W, PROJECT AS P
WHERE E.Ssn=W.Essn AND W.Pno=P.Pnumber AND
P.Pname=‘ProductX’;

117
Q

Retrieve all employees in department 5 whose salary is between $30,000 and $40,000.

A

SELECT *
FROM EMPLOYEE
WHERE (Salary BETWEEN 30000 AND 40000) AND Dno = 5;

118
Q

The condition (Salary BETWEEN 30000 AND 40000) in Q14 is equivalent to

A

((Salary >= 30000) AND (Salary

119
Q

ORDER BY

A

SQL allows the user to order the tuples in the result of a query by the values of one or more of the attributes that appear in the query result

120
Q

Retrieve a list of employees and the projects they are working on, ordered by department and, within each department, ordered alphabetically by last name, then first name.

A

SELECT D.Dname, E.Lname, E.Fname, P.Pname
FROM DEPARTMENT D, EMPLOYEE E, WORKS_ON W, PROJECT P
WHERE D.Dnumber= E.Dno AND E.Ssn= W.Essn AND W.Pno= P.Pnumber
ORDER BY D.Dname, E.Lname, E.Fname;

121
Q

default order by order

A

ascending

122
Q

how to see results in descending order

A

DESC

123
Q

how to specify ascending order explicitly

A

ASC

124
Q

if we want descending alphabetical order on Dname and ascending order on Lname, Fname, the ORDER BY clause of Q15 can be written as

A

ORDER BY D.Dname DESC, E.Lname ASC, E.Fname ASC

125
Q

INSERT

A

add a single tuple to relation

126
Q

what needed for insert

A

specify relation name and list of values for the tuple, with values listed in same order in which corresponding attributes were specified in the CREATE TABLE command

127
Q

Add a new tuple to the EMPLOYEE relation

A

INSERT INTO EMPLOYEE

VALUES (‘Richard’,‘K’,‘Marini’,‘653298653’,‘1962-12-30’,‘98 Oak Forest, Katy, TX’, ‘M’, 37000, ‘653298653’, 4 );

128
Q

Second form of Insert statement

A

allows the user to specify explicit attribute names that correspond to the values provided in the INSERT command

129
Q

For example, to enter a tuple for a new EMPLOYEE for whom we know only the Fname, Lname, Dno, and Ssn attributes

A

INSERT INTO EMPLOYEE (Fname, Lname, Dno, Ssn)

VALUES (‘Richard’, ‘Marini’, 4, ‘653298653’);

130
Q

restriction on when inserting only some variables in a tuple

A

values must include all attributes with NOT NULL specification and no default value. Attributes with NULL allowed or DEFAULT values are the ones that can be left out

131
Q

inserting multiple tuples into a relation

A

possible to insert into a relation multiple tuples separated by commas in a single INSERT command. The attribute values forming each tuple are enclosed in parentheses.

132
Q

INSERT INTO EMPLOYEE (Fname, Lname, Ssn, Dno)
VALUES (‘Robert’, ‘Hatcher’, ‘980760540’, 2);

outcome

A

rejected if referential integrity checking is provided by DBMS.

133
Q

INSERT INTO EMPLOYEE (Fname, Lname, Dno)
VALUES (‘Robert’, ‘Hatcher’, 5);

outcome

A

rejected if NOT NULL checking is provided by DBMS

134
Q

create a temporary table that has the employee last name, project name, and hours per week for each employee working on a project

A

CREATE TABLE
( Emp_name Proj_name Hours_per_week
WORKS_ON_INFO VARCHAR(15), VARCHAR(15), DECIMAL(3,1) );

INSERT INTO WORKS_ON_INFO ( Emp_name, Proj_name, Hours_per_week )
SELECT E.Lname, P.Pname, W.Hours
FROM PROJECT P, WORKS_ON W, EMPLOYEE E
WHERE P.Pnumber=W.Pno AND W.Essn=E.Ssn;

135
Q

DELETE

A

removes tuples from a relation

136
Q

delete includes

A

WHERE clause, similar to that used in an SQL query, to select the tuples to be deleted

137
Q

where are tuples exclusively deleted from

A

only one table at a time

138
Q

a missing where when using delete

A

all tuples in the relation are to be deleted; however, the table remains in the database as an empty table (must DROP TABLE to remove table definition

139
Q

delete all employees with last name Brown

A

DELETE FROM EMPLOYEE

WHERE Lname = ‘Brown’;

140
Q

delete everyone from dept 5

A

DELETE FROM EMPLOYEE

WHERE Dno =5;

141
Q

delete everything from EMPLOYEE TABLE

A

DELETE FROM EMPLOYEE; (table definition remains)

142
Q

UPDATE

A

used to modify attribute values of one or more selected tuples

143
Q

WHERE clause in the UPDATE command

A

selects the tuples to be modified from a single relation

144
Q

change the location and controlling department number of project number 10 to ‘Bellaire’ and 5, respectively

A

UPDATE PROJECT

SET Plocation = ‘Bellaire’, Dnum = 5 WHERE Pnumber=10;

145
Q

give all employees in the ‘Research’ department a 10 percent raise in salary,

A

UPDATE EMPLOYEE
SET Salary = Salary * 1.1
WHERE Dno = 5;

146
Q

can you set NULL or DEFAULT as new attribute

A

YES