SQL Test For Mappers

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Sidhu_virgo
S
Sidhu_virgo
Community Contributor
Quizzes Created: 1 | Total Attempts: 263
Questions: 10 | Attempts: 263

SettingsSettingsSettings
SQL Quizzes & Trivia

Dear All,
This quiz contains 10 quesions on SQL. Thought these quizzes will help us keep involved in some constructive work. If its ok to all the next one would be Unix followed by systems like MICA,BPI,FLEXCAB and CR'S


Questions and Answers
  • 1. 

    1. What does SQL stand for?

    • A.

      Structured Question Language

    • B.

      Structured Query Language

    • C.

      Strong Question Language

    Correct Answer
    B. Structured Query Language
    Explanation
    SQL stands for Structured Query Language. It is a programming language used for managing and manipulating relational databases. With SQL, users can create, modify, and retrieve data from databases. It provides a standardized way to interact with databases, allowing users to write queries to retrieve specific information or perform actions such as inserting, updating, or deleting data. The correct answer, "Structured Query Language," accurately reflects the purpose and functionality of SQL.

    Rate this question:

  • 2. 

    Which SQL statement is used to extract data from a database?

    • A.

      SELECT

    • B.

      EXTRACT

    • C.

      GET

    • D.

      OPEN

    Correct Answer
    A. SELECT
    Explanation
    The SELECT statement is used to extract data from a database. It allows you to specify which columns and rows you want to retrieve from a table or multiple tables. By using various clauses such as WHERE, ORDER BY, and JOIN, you can further refine the data that is returned. This statement is a fundamental part of SQL and is essential for querying and retrieving information from a database.

    Rate this question:

  • 3. 

    Which SQL statement is used to update data in a database?

    • A.

      MODIFY

    • B.

      SAVE

    • C.

      UPDATE

    • D.

      SAVE AS

    Correct Answer
    C. UPDATE
    Explanation
    The correct answer is UPDATE. The UPDATE statement is used in SQL to modify or update existing data in a database. It allows you to change the values of one or more columns in a table based on specified conditions. This statement is essential for making changes to data stored in a database, such as updating records with new information or correcting errors.

    Rate this question:

  • 4. 

    Which SQL statement is used to delete data from a database?

    • A.

      REMOVE

    • B.

      COLLAPSE

    • C.

      DELETE

    Correct Answer
    C. DELETE
    Explanation
    The correct answer is DELETE. DELETE is the SQL statement used to remove data from a database. This statement allows you to delete specific rows or all the rows from a table, depending on the condition specified in the WHERE clause. It is a crucial command for managing and maintaining the data integrity of a database.

    Rate this question:

  • 5. 

    Which SQL statement is used to insert new data in a database?

    • A.

      INSERT NEW

    • B.

      ADD NEW

    • C.

      INSERT INTO

    • D.

      ADD RECORD

    Correct Answer
    C. INSERT INTO
    Explanation
    The correct answer is "INSERT INTO". This SQL statement is used to insert new data into a database. It allows you to specify the table where the data will be inserted and provide the values for the new record. The "INSERT INTO" statement is a fundamental part of SQL and is commonly used when adding new data to a database table.

    Rate this question:

  • 6. 

    With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?

    • A.

      SELECT * FROM Persons WHERE FirstName LIKE 'a%'

    • B.

      SELECT * FROM Persons WHERE FirstName LIKE '%a'

    • C.

      SELECT * FROM Persons WHERE FirstName='%a%'

    • D.

      SELECT * FROM Persons WHERE FirstName='a'

    Correct Answer
    A. SELECT * FROM Persons WHERE FirstName LIKE 'a%'
    Explanation
    The correct answer is "SELECT * FROM Persons WHERE FirstName LIKE 'a%'". This query uses the LIKE operator with the pattern 'a%' to match any values in the FirstName column that start with the letter "a". The '%' symbol is a wildcard that represents any number of characters. Therefore, this query will select all the records from the Persons table where the FirstName column starts with "a".

    Rate this question:

  • 7. 

    Which SQL statement is used to return only different values?

    • A.

      SELECT DIFFERENT

    • B.

      SELECT UNIQUE

    • C.

      SELECT DISTINCT

    • D.

      SELECT ALL

    Correct Answer
    C. SELECT DISTINCT
    Explanation
    The SQL statement "SELECT DISTINCT" is used to return only different values. It eliminates duplicate values from the result set and only retrieves unique values. This is helpful when you want to retrieve distinct values from a column or multiple columns in a table.

    Rate this question:

  • 8. 

    How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?

    • A.

      MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen

    • B.

      UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'

    • C.

      MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen'

    • D.

      UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen'

    Correct Answer
    B. UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'
    Explanation
    The correct answer is "UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'". This is the correct answer because it uses the UPDATE statement to modify the LastName column in the Persons table. It sets the value of LastName to 'Nilsen' for all rows where the current value of LastName is 'Hansen'.

    Rate this question:

  • 9. 

    The Person table has the following structure :Last_Name Varchar2(30);Salary number(8,2);Commision_PCT number (5,2).You want to display the name and the annual salary multiplied by the commission_pct for all the employees. and the annual commission.Additionally records that have a null value for Commision_PCT a zero must be displayed against the calculated column.Which SQL statement display the desired results?

    • A.

      Select Last_Name,(salary*12)*NVL(Commision_PCT,0) FROM Person

    • B.

      Select Last_Name,(salary*12)*NVL2(Commision_PCT,0) FROM Person

    • C.

      Select Last_Name,(salary*12)* ifnull(Commision_PCT,0) FROM Person

    • D.

      Select Last_Name,(salary*12)*NVL(Commision_PCT,0) FROM Person

    Correct Answer
    A. Select Last_Name,(salary*12)*NVL(Commision_PCT,0) FROM Person
    Explanation
    The correct answer is "select Last_Name,(salary*12)*NVL(Commision_PCT,0) FROM Person". This SQL statement uses the NVL function to replace any null values in the Commision_PCT column with 0 before multiplying it with the annual salary. This ensures that even if there are null values in the Commision_PCT column, the calculated column will still display a value of 0.

    Rate this question:

  • 10. 

    Examine the data in the EMPLOYEES table:  LAST_NAME              DEPARTMENT_ID             SALARY  Getz                                 10                                        3000  Davis                               20                                         1500  King                                20                                          2200  Davis                              30                                          5000 ...  Which of these Subqueries work?

    • A.

      SELECT * FROM employees where salary > (SELECT MIN(salary) FROM employees GROUP BY department.id);

    • B.

      B. SELECT * FROM employees WHERE salary = (SELECT AVG(salary) FROM employees GROUP BY department_id);

    • C.

      SELECT distinct department_id FROM employees Where salary > ANY (SELECT AVG(salary) FROM employees GROUP BY department_id);

    • D.

      D. SELECT department_id FROM employees WHERE SALARY > (SELECT AVG(salary) FROM employees GROUP BY department_id);

    Correct Answer(s)
    C. SELECT distinct department_id FROM employees Where salary > ANY (SELECT AVG(salary) FROM employees GROUP BY department_id);
    D. D. SELECT department_id FROM employees WHERE SALARY > (SELECT AVG(salary) FROM employees GROUP BY department_id);
    Explanation
    The given subqueries work because they both use the correct syntax and logic to retrieve the desired results. In the first subquery, it selects the distinct department_id from the employees table where the salary is greater than any average salary calculated for each department. This ensures that only the department_ids with salaries higher than the average are returned. The second subquery selects the department_id from the employees table where the salary is greater than the average salary calculated for each department. Again, this ensures that only the department_ids with salaries higher than the average are returned.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Mar 03, 2009
    Quiz Created by
    Sidhu_virgo

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.