SQL Programming for Data Mining for Data Mining MCQs
General SQL
What does SQL stand for?
a) Structured Query Language
b) Standard Query Language
c) Simple Query Language
d) Sequential Query Language
Answer: a) Structured Query Language
Which SQL clause is used to filter records?
a) WHERE
b) SELECT
c) ORDER BY
d) GROUP BY
Answer: a) WHERE
How do you select all the columns from a table named “customers”?
a) SELECT * FROM customers;
b) SELECT all FROM customers;
c) SELECT columns FROM customers;
d) SELECT all_columns FROM customers;
Answer: a) SELECT * FROM customers;
Which SQL statement is used to delete data from a table?
a) REMOVE
b) DELETE
c) DROP
d) CLEAR
Answer: b) DELETE
How do you sort the result set in ascending order by “age”?
a) ORDER BY age ASC;
b) SORT BY age;
c) ORDER age ASC;
d) SORT age;
Answer: a) ORDER BY age ASC;
SQL Functions and Aggregates
Which function is used to count the number of rows in a table?
a) SUM()
b) COUNT()
c) NUMBER()
d) TOTAL()
Answer: b) COUNT()
How do you calculate the average value of the “salary” column in a table named “employees”?
a) SELECT MEAN(salary) FROM employees;
b) SELECT AVG(salary) FROM employees;
c) SELECT SUM(salary) FROM employees;
d) SELECT AVERAGE(salary) FROM employees;
Answer: b) SELECT AVG(salary) FROM employees;
Which SQL clause is used to group rows that have the same values?
a) GROUP BY
b) ORDER BY
c) WHERE
d) FILTER BY
Answer: a) GROUP BY
How do you select the minimum value of the “price” column from the “products” table?
a) SELECT MIN(price) FROM products;
b) SELECT LEAST(price) FROM products;
c) SELECT LOW(price) FROM products;
d) SELECT MINIMUM(price) FROM products;
Answer: a) SELECT MIN(price) FROM products;
Which SQL function returns the maximum value of a column?
a) MAX()
b) HIGHEST()
c) TOP()
d) UPPER()
Answer: a) MAX()
Joins
What is the purpose of the JOIN clause in SQL?
a) To combine rows from two or more tables based on a related column
b) To delete rows in a table
c) To update rows in a table
d) To sort the result set
Answer: a) To combine rows from two or more tables based on a related column
How do you perform an inner join between two tables “orders” and “customers” on the “customer_id” column?
a) SELECT * FROM orders INNER JOIN customers ON orders.customer_id = customers.customer_id;
b) SELECT * FROM orders JOIN customers WHERE orders.customer_id = customers.customer_id;
c) SELECT * FROM orders FULL JOIN customers ON orders.customer_id = customers.customer_id;
d) SELECT * FROM orders LEFT JOIN customers ON orders.customer_id = customers.customer_id;
Answer: a) SELECT * FROM orders INNER JOIN customers ON orders.customer_id = customers.customer_id;
Which join returns all rows from the left table and the matched rows from the right table?
a) LEFT JOIN
b) RIGHT JOIN
c) INNER JOIN
d) FULL JOIN
Answer: a) LEFT JOIN
What does a FULL JOIN return?
a) All rows when there is a match in either left or right table
b) All rows from the left table
c) All rows from the right table
d) Only the matched rows from both tables
Answer: a) All rows when there is a match in either left or right table
How do you perform a self-join?
a) Joining a table with itself
b) Joining two different tables
c) Joining three tables together
d) Joining a table with a view
Answer: a) Joining a table with itself
Advanced SQL
What is a subquery in SQL?
a) A query within another query
b) A query that updates multiple rows
c) A query that deletes data
d) A query that creates a new table
Answer: a) A query within another query
How do you create an index on the “name” column in the “students” table?
a) CREATE INDEX idx_name ON students(name);
b) ADD INDEX idx_name ON students(name);
c) MAKE INDEX idx_name ON students(name);
d) SET INDEX idx_name ON students(name);
Answer: a) CREATE INDEX idx_name ON students(name);
What does the SQL statement ALTER TABLE employees ADD COLUMN age INT; do?
a) Adds a new column “age” of type INT to the “employees” table
b) Changes the data type of the “age” column in the “employees” table
c) Deletes the “age” column from the “employees” table
d) Renames the “employees” table to “age”
Answer: a) Adds a new column “age” of type INT to the “employees” table
How do you remove a table named “sales” from a database?
a) DROP TABLE sales;
b) DELETE TABLE sales;
c) REMOVE TABLE sales;
d) CLEAR TABLE sales;
Answer: a) DROP TABLE sales;
Which SQL statement is used to modify data in a table?
a) UPDATE
b) MODIFY
c) ALTER
d) CHANGE
Answer: a) UPDATE
More Next Data Mining MCQs
- Repeated Data Mining MCQs
- Classification in Data mining MCQs
- Clustering in Data mining MCQs
- Data Analysis and Experimental Design MCQs
- Basics of Data Science MCQs
- Big Data MCQs
- Caret Data Science MCQs
- Binary and Count Outcomes MCQs
- CLI and Git Workflow
- Data Preprocessing MCQs
- Data Warehousing and OLAP MCQs
- Association Rule Learning MCQs
- Classification
- Clustering
- Regression MCQs
- Anomaly Detection MCQs
- Text Mining and Natural Language Processing (NLP) MCQs
- Web Mining MCQs
- Sequential Pattern Mining MCQs
- Time Series Analysis MCQs
Data Mining Algorithms and Techniques MCQs
- Frequent Itemset Mining MCQs
- Dimensionality Reduction MCQs
- Ensemble Methods MCQs
- Data Mining Tools and Software MCQs
- Python Programming for Data Mining MCQs (Pandas, NumPy, Scikit-Learn)
- R Programming for Data Mining(dplyr, ggplot2, caret) MCQs
- SQL Programming for Data Mining for Data Mining MCQs
- Big Data Technologies MCQs