0% found this document useful (0 votes)
21 views3 pages

Sample Questions Answers

The document contains a set of sample questions related to SQL and NoSQL databases, covering syntax errors, query results, and database characteristics. It includes questions about specific SQL statements, their correctness, and concepts related to NoSQL databases. Additionally, it addresses the use of Python pandas and JSON queries.

Uploaded by

Alex Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

Sample Questions Answers

The document contains a set of sample questions related to SQL and NoSQL databases, covering syntax errors, query results, and database characteristics. It includes questions about specific SQL statements, their correctness, and concepts related to NoSQL databases. Additionally, it addresses the use of Python pandas and JSON queries.

Uploaded by

Alex Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Sample Questions

Part 1: SQL
Please use the following database schema to answer questions 1-9. Assume all PK and FK columns have
INTEGER data type and data types of all other columns are as expected.

CUSTOMER (CustomerID, FirstName, LastName, AmountDue, City, State)


PRODUCT (ProductCode, Description, Price, SupplierID)
SUPPLIER (SupplierID, Supplier-Name, City, State)
INVOICE (Invoice#, Invoice-Date, Invoice-Amount, CustomerID)

QUESTION #1: For each state, you want to display name of the state and number of customers that the company has in
the state. Review this statement and determine if it contains a syntax error, and if so on which line.
1. SELECT state, COUNT(*)
2. FROM CUSTOMER
3. GROUP BY state;
The above statement has: (a) no error (b) error on line 1 (c) error on line 2 (d) error on line 3

QUESTION #2: Does the following statement contain any syntax error?
SELECT COUNT(*)
FROM CUSTOMER
GROUP BY state;
The above statement: (a) it has no error (b) it has a syntax error

QUESTION #3: You write the following statement to know how many total suppliers the company has. Is this the right
statement for this purpose?
SELECT COUNT(*)
FROM supplier;
(a) Yes (b) No

QUESTION #4: You write the following statement to know how many total suppliers the company has. Is this the right
statement for this purpose?
SELECT COUNT(supplierID)
FROM product;
(a) Yes (b) No

QUESTION #5: Does the following statement contain any syntax error?
select ProductCode from product
where ProductCode = 21225 or supplierID is null;
The above statement: (a) has no error (b) has a syntax error

QUESTION #6: The following query will display:

(a) All customers whether they do or do not have any invoices


(b) All invoices whether associated with any customers or not
(c) None of the above

SELECT state, LastName, invoice#


FROM CUSTOMER LEFT OUTER JOIN INVOICE USING(CustomerID);

This study source was downloaded by 100000868930969 from CourseHero.com on 06-29-2023 15:52:03 GMT -05:00

https://www.coursehero.com/file/87518682/Sample-Questions-Answersdocx/
QUESTION #7: Does the following statement contain any syntax error, if so on which line?

1. SELECT state, LastName, invoice#


2. FROM CUSTOMER JOIN INVOICE USING(CustomerID)
3. WHERE invoice-date IS NOT NULL;
The above statement has: (a) no error (b) error on line 1 (c) error on line 2 (d) error on line 3

QUESTION #8: Does the following statement contain any syntax error, if so on which line?

1. SELECT state, LastName, CustomerID


2. FROM CUSTOMER, INVOICE
3. WHERE Customer.CustomerID = INVOICE.CustomerID;
The above statement has: (a) no error (b) error on line 1 (c) error on line 2 (d) error on line 3

QUESTION #9: To add a new row to the INVOICE table, the following type of DML statement should be used (one word
only): -------------- INSERT

For Questions 10-12, please use the following PRODUCT table and data:

Product# Product_Name Price


77 shoe 20
25 jacket 30
38 shoe 30
45 shirt

QUESTION #10: What will the following statement generate when you run it? If it will generate an error then write the
word “ERROR”; otherwise write the output: -------------- 3

SELECT price*.1 FROM product WHERE product# = 25;

QUESTION #11: What will the following statement generate when you run it? If it will generate an error then write the
word “ERROR”; otherwise write the output: -------------- NULL

SELECT price*.1 FROM product WHERE product# = 45;

QUESTION #12: What will the following statement generate when you run it? If it will generate an error then write the
word “ERROR”; otherwise write the output: -------------- 4

SELECT COUNT(*) FROM product;

*******

Part 2: NoSQL
(1) Which of the following types of databases has better ACID compliance?
(a) relational databases (b) NoSQL databases (c) big data databases

This study source was downloaded by 100000868930969 from CourseHero.com on 06-29-2023 15:52:03 GMT -05:00

https://www.coursehero.com/file/87518682/Sample-Questions-Answersdocx/
(2) Suppose a JSON collection in a large NoSQL database contains the same data that is stored in multiple tables in a
relational database. We need to process a query that requires retrieving data from multiple tables in a relational database
or multiple documents in a NoSQL database. Which of these choices is more likely to have shorter query response time?

(a) relational database (b) NoSQL database

(3) Which of the following types of databases use schema on write?

(a) relational databases (b) NoSQL databases (c) big data databases

(4) What does the following MongoDB expression mean?

{title: "professor", last_name: "Lee"}

(a) professor/s whose last name is Lee (b) professor/s or anyone whose last name is Lee
(c) none of the above

(5) Review the following JSON document and determine which of the following is correct query to search for all books
published in 2014?

(a) {"checkouts.pubyear": 2014} (b) {pubyear: 2014}

(6) What is Python pandas?


(a) a Python library (b) a Python function (c) a table of data (d) none of the above

(7) Consider the following code snippet: df.head()


What does the head() function do?

(a) shows column headings in the df data frame


(b) shows column headings and data from top few rows of the df data frame

This study source was downloaded by 100000868930969 from CourseHero.com on 06-29-2023 15:52:03 GMT -05:00

https://www.coursehero.com/file/87518682/Sample-Questions-Answersdocx/
Powered by TCPDF (www.tcpdf.org)

You might also like