Question: A table has following values for its department field:
marketing, production, production, sales, NULL, NULL, Marketing, Null
What will the following query return:
Select distinct(department) from employees;
Question: Consider the following tables:
Books
------
BookId
BookName
AuthorId
SubjectId
PopularityRating (the popularity of the book on a scale of 1 to 10)
Language (such as French, English, German etc)
Subjects
---------
SubjectId
Subject (such as History, Geography, Mathematics etc)
Authors
--------
AuthorId
AuthorName
Country
What is the query to determine which Authors have written at least 1 book with a popularity rating of less than 5?
A
select authorname from authors where authorid in (select authorid from books where popularityrating<5)
B
select authorname from authors where authorid in (select authorid from books where popularityrating<=5)
C
select authorname from authors where authorid in (select BookId from books where popularityrating<5)
D
select authorname from authors where authorid in (select authorid from books where popularityrating in (0,5))
Question: Choose the appropriate query for the Products table where data should be displayed primarily in ascending order of the ProductGroup column. Secondary sorting should be in descending order of the CurrentStock column.
A
Select * from Products order by CurrentStock,ProductGroup
B
Select * from Products order by CurrentStock DESC,ProductGroup
C
Select * from Products order by ProductGroup,CurrentStock
D
Select * from Products order by ProductGroup,CurrentStock DESC
Question: Consider the following two tables:
1. customers( customer_id, customer_name)
2. branch ( branch_id, branch_name )
What will be the output if the following query is executed:
Select *, branch_name from customers, branch
A
It will return the fields customer_id, customer_name, branch_name with a cartesian join
B
It will return the fields customer_id, customer_name, branch_id, branch_name with a cartesian join
C
It will return the fields customer_id, customer_name, branch_id, branch_name, branch_name with a cartesian join
D
It will return an empty set since the two tables do not have any common field name
E
It will return an error since * should be for queries involving one table only