WorksheetsSEMIFINAL EXAM IN INFORMATION MANAGEMENT_BSIT 2A
Total questions: 16
Worksheet time: 14mins
Which is the correct SQL Statement to add a column 'region_id' to the table locations.
ALTER TABLE locations
ADD region_id INT;
UPDATE TABLE locations
ADD region_id INT;
ALTER TABLE locations
SET region_id as INT;
What is the write query statement to get unique department ID from Employee table?
SELECT UNIQUE department_id
FROM Employees;
SELECT DISTINCT department_id
FROM Employees;
SELECT EXISTS department_id
FROM Employees
WHERE department_id = NOT EXISTS;
To name a new column, use _ clause and use mathematical operators for the computation
(a)
DELETE TABLE statement unlike the DROP command, not only deletes all the records in a table but deletes the table itself, making you unable to perform SQL commands into the table ever again.
True
False
All are correct about INSERT statements except:
selected columns in the table will be inserted with a value
the values in the statement should match the number of columns defined in the statement
In most cases it should also include a WHERE clause.
In the _ syntax no column names are defined, since you are essentially deleting an entire record from a table.
(a)
OPERATORS are used to compare and evaluate values and they usually appear inside the conditional statements in a WHERE Clause.
TRUE
FALSE
MS Access uses an _ instead of the percent sign (%), and a question mark (?) instead of the underscore (_).
(a)
What character is used to substitute one or more characters in a string?
Wildcard
Percent sign
Question Mark
Among the CRUD commands we have discussed, which would be the "safest"?
(a)
They are called _ in SQL because they used to give a database or column name a temporary name to make it more readable.
ALIASES
UNIQUE
DISTINCT
This clause is used to define the order of the query output either in ascending (ASC) or in descending (DESC). Ascending (ASC) is set as the default one but descending (DESC) is set explicitly.
ORDER BY Clause
SORT BY Clause
GROUP BY
How to write a query to show the details of a student from Students table whose name starts with J?
SELECT * FROM Students WHERE StudName like ‘*J*’;
SELECT * FROM Students WHERE StudName like ‘J*’;
SELECT FROM Students WHERE StudName like ‘*J’;
When a table’s primary key field is added to related tables in order to create the common field which relates the two tables, it called a _ key in other tables.
(a)
How can we avoid duplicating records in a query?
By using the DISTINCT keyword, duplication of records in a query can be avoided.
Provide set of rules that restrict the values of one or more columns of the tables based on the values of the primary key or unique key of the referenced table.
How many customers purchased an item labeled as "raft"?
SELECT COUNT
(customerID)
FROM items_ordered
WHERE item='raft';
SELECT * AS COUNT
(customerID)
WHERE item='raft'
FROM items_ordered;
SELECT
(customerID) COUNT FROM items_ordered
WHERE item='raft' ;
