Quiz
Week 5 and 6
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (13)
1Consider two cases:
(1) r join s on r.A=s.B, and
(2) r left join s on r.A=s.B.
Which of the following statements best describes the two cases?- A(1) may produce the same number of columns and the same number of tuples as those by (2).
- B(2) produces less tuples as it concerns dangling tuples.
- Cc. (2) is used because the user wants to see more null values in the output.
- Dd. (1) produces less columns than (2).
2What is true about the NOT JOIN in the following query:
SELECT *
FROM CHARACTERS C1 NOT JOIN CHARACTERS C2
ON C1.characterID = C2.characterID- AIt is the equivalent to an INNER JOIN ON C1.characterID <> C2.characterID.
- BIt is a JOIN which restricts how the normal INNER JOIN works.
- CIt is one of the several types of JOINs in SQL Server.
- DNone of these are correct. NOT JOIN is not a valid JOIN.
3Consider the table tblStaff(name, position, department, salary).
Write SQL statement to increase the salary by 10% for those having salary at most 50K, and by 5% for those having salary over 50K.
Which of the following statements is correct in terms of correct syntax and having no possibility of incorrect outcome?- AUPDATE tblStaff
SET salary = salary * 1.1
WHERE salary <= 50000;
UPDATE tblStaff
SET salary = salary * 1.05
WHERE salary > 50000; - BUPDATE tblStaff
SET salary = salary * 1.1
WHERE salary <= 50000
SET salary = salary * 1.05
WHERE salary > 50000; - CUPDATE tblStaff
SET salary = salary * 1.05
WHERE salary > 50000
SET salary = salary * 1.1
WHERE salary <= 50000; - DUPDATE tblStaff
SET salary = salary * 1.05
WHERE salary > 50000;
UPDATE tblStaff
SET salary = salary * 1.1
WHERE salary <= 50000;
- AUPDATE tblStaff
4Consider the following SQL DDL for a table tblPerson:
CREATE TABLE tblPerson(
PersonID INTEGER(5) NOT NULL,
FirstName VARCHAR(30) NOT NULL,
LastName VARCHAR(30),
BirthDate DATE NOT NULL,
Salary FLOAT(8,2),
PRIMARY KEY (PersonID)
);
Again, consider an instance of the table tblPerson looks as follows:
Which of the following statements will not fail to execute?- AINSERT INTO tblPerson
VALUES(30003, 'Carol', 'Danvers', '1980-07-08', 200K); - BINSERT INTO tblPerson
VALUES(30002, 'Bruce', 'Banner', '1970-07-04', 100000.00); - CINSERT INTO tblPerson
VALUES(30033, 'Thor', , '1370-12-21', ); - DINSERT INTO tblPerson
VALUES(30067, 'Natasha', 'Romanof', , 70000.00);
- AINSERT INTO tblPerson
5[True/False]: Consider the table tblProduct(ProductCode, ProductName, Price).
The SQL statement
DELETE FROM tblProduct;
will not be executed as there is no WHERE clause added.- ATrue
- BFalse
6Which of the followings is a basic key word from SQL Data Manipulation Language?
- AALTER
- BCREATE
- CINSERT
- DDROP
7Which of the followings is NOT a common SQL data types?
- Adecimal(m,n)
- Bint
- CString
- Ddatetime
8Consider the table tblStudent(name, age, address).
Which of the following INSERT statements is not correct?- AINSERT INTO tblStudent(name, address, age) VALUES ('Sam', 'Sydney', 21);
- BINSERT INTO tblStudent VALUES ('Bob', 27, 'Brisbane');
- CINSERT INTO tblStudent VALUES ('Morris, 'Melbourne', 45);
- DINSERT INTO tblStudent(name, age, address) VALUES ('Adam', 32, 'Adelaide');
9Given the following tables, if you want to return all employees with or without a matching department, which query would you use?
Departments
departmentID department
1 Sewing
2 Sales
3 Beanies
4 Boogie Boards
5 Parties
Employees
name department salary
Jess 10 5000
Nathan 5 12000
Peter 3 6000
Jennifer 2 8000- ASELECT e.name, d.department
FROM employees e LEFT OUTER JOIN departments d
ON (e.department = d.departmentID); - BSELECT e.name, d.department
FROM employees e INNER JOIN departments d
ON (e.department = d.departmentID); - CSELECT e.name, d.department
FROM employees e RIGHT OUTER JOIN departments d
ON (e.department = d.departmentID); - DSELECT name, department
FROM employees LEFT OUTER JOIN departments
ON (department = departmentID);
- ASELECT e.name, d.department
10Consider the table tblCourse(courseCode, courseTitle, creditPoint).
In order to view all the records in the table, which of the following statements need to be executed?- ASELECT ALL-RECORDS
FROM tblCourse; - BSELECT *
FROM tblCourse; - CSELECT ALL-ATTRIBUTES
FROM tblCourse; - DSELECT ALL
FROM tblCourse;
- ASELECT ALL-RECORDS
11Consider the table tblItem(ItemCode, ItemName).
Which of the following statements will delete the table from the database?- ACLEAR TABLE tblItem
- BREMOVE TABLE tblItem
- CDELETE TABLE tblItem
- DDROP TABLE tblItem
12Consider the SQL DDL statement given below:
CREATE TABLE a1 (a1 int, a2 char(10), a3 date);
Which of the followings is the most appropriate?- Athe second a1 is an attribute name
- Bthe table has two attributes
- Cthe statement has a syntax error because 'a1' is used twice
- Ddate is an attribute name
13What is wrong with the statements?
CREATE TABLE a1 (a1 int primary key, a2 int primary key);
CREATE TABLE b1 (a1 int references a1, a2 references a1);- A'a1' is used for too many times
- Bprimary key is missed from the second table
- C'references' is used for too many times in the second statement
- D'primary key' is used for too many times in the first statement
Information
- Description
- Quiz on Week 5 and 6, created by Dani Nunns on 06/11/2020.
- Author
- Dani Nunns
- Language
- English
- Views
- 1
- Rating
- No ratings yet Rate this quiz