SQL Test

Description

Basic SQL Test
rahim.ali
Quiz by rahim.ali, updated more than 1 year ago
rahim.ali
Created by rahim.ali over 8 years ago
357
1

Resource summary

Question 1

Question
Which of the following code would grant the role student_admin to a user named william?
Answer
  • A - grant student_admin to william;
  • B - grant to william student_admin;
  • C - grant william student_admin;
  • D - None of the above.

Question 2

Question
Select the right query for retrieving records from the tables HONOURS_SUBJECT and LOCATIONS with a right outer join HONOURS_SUBJECT(subject_code, subject_name, department_head); LOCATIONS(subject_code, department_name, location_id, city);
Answer
  • A - select h.subject_name, l.department_name, h.department_head, l.city from honours_subject h on right outer join location l where(h.subject_code = l.subject_code);
  • B - select h.subject_name, l.department_name, h.department_head, l.city from honours_subject h outer join location l on(subject_code);
  • C - select h.subject_name, l.department_name, h.department_head, l.city from honours_subject h right outer join location l on(h.subject_code = l.subject_code);
  • D - None of the above.

Question 3

Question
Q - Which of the following code will remove all the rows from the table LOCATIONS?
Answer
  • A - DROP TABLE locations;
  • B - DELETE TABLE locations;
  • C - TRUNCATE TABLE locations;
  • D - None of the above.

Question 4

Question
Which of the following is not true about modifying rows in a table?
Answer
  • A - Existing rows in a table are modified using the UPDATE statement.
  • B - You can update more than one row at a time.
  • C - All the rows in a table are modified if you omit the WHERE clause.
  • D - None of the above.

Question 5

Question
Consider the following schema − STUDENTS(student_code, first_name, last_name, email, phone_no, date_of_birth, honours_subject, percentage_of_marks); Which of the following query would display the distinct honours subjects in the STUDENTS table?
Answer
  • A - select honours_subject from students;
  • B - select distinct honours_subject from students;
  • C - select all honours_subject from students;
  • D - select * from students;

Question 6

Question
Q 12 - Which of the following is not a character manipulation function?
Answer
  • A - concat
  • B - substr
  • C - instr
  • D - coalesce

Question 7

Question
Q 14 - Which of the following is true about inserting news rows to a table?
Answer
  • A - You must list values in the default order of the columns in the table.
  • B - You can also list the columns in the INSERT clause.
  • C - You can use the INSERT statement to add rows from one table to another.
  • D - All of the above.

Question 8

Question
Given the following data definition, select all queries that return a list of employees who are not managers. TABLE emp id INTEGER NOT NULL PRIMARY KEY mgrId INTEGER REFERENCES emp (id) name VARCHAR(30) NOT NULL
Answer
  • A SELECT e.name FROM emp e WHERE e.id NOT IN ( SELECT DISTINCT m.mgrId FROM emp m)
  • B SELECT e.name FROM emp e WHERE e.id NOT IN ( SELECT DISTINCT m.mgrId FROM emp m WHERE m.mgrId IS NOT NULL)
  • C SELECT e.name FROM emp e WHERE e.id NOT IN ( SELECT m.mgrId FROM emp m)
  • D SELECT e.name FROM emp e WHERE e.id NOT IN ( SELECT m.mgrId FROM emp m WHERE m.mgrId IS NOT NULL)

Question 9

Question
9. Which of the follwing statements is/are not true for SQL profiler?
Answer
  • enables you to monitor events
  • check if rows are being inserted properly
  • check the performance of a stored procedure
  • ALL answers are correct
Show full summary Hide full summary

Similar

Higher Level Economics
Jim hammerton
To Kill A Mockingbird Complete Notes
jessica.moscrip
GCSE Biology heart notes
Kamila Woloszyn
Joomla Extension
Santi Sounsri
A2 Organic Chemistry - Reactions
yannycollins
med chem 2
lola_smily
Memory: AS Psychology
rae_olamide_xo
Biology Unit 1a - GCSE - AQA
RosettaStoneDecoded
PHR Sample Questions
Elizabeth Rogers8284
Core 1.4 Developments in Modern and Smart Materials
T Andrews
Family in the park
Eleuterio Caicedo Valencia