The Ultimate SQL Syntax And Functionality Knowledge Test

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 Themes
T
Themes
Community Contributor
Quizzes Created: 416 | Total Attempts: 709,551
Questions: 40 | Attempts: 282

SettingsSettingsSettings
The Ultimate SQL Syntax And Functionality Knowledge Test - Quiz

Since its creation in 1974, SQL has become the most popular programming language for relational database management. With its fine set of functions and easy to learn syntax, it provides the ability to store, manipulate, and retrieve data in databases. Do you have good hands at SQL programming? Well, take this test and see for yourself.


Questions and Answers
  • 1. 

    Nomalization reduces data redundancy.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Normalization is a process in database design that eliminates data redundancy by organizing data into separate tables and establishing relationships between them. By doing so, each piece of data is stored only once, reducing the chances of inconsistencies and improving data integrity. Therefore, the statement that normalization reduces data redundancy is true.

    Rate this question:

  • 2. 

    Nomalization increases the isk of loosing data integity

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    Normalization actually reduces the risk of losing data integrity. It is a process in database design that eliminates redundancy and ensures that data is stored efficiently and accurately. By organizing data into separate tables and establishing relationships between them, normalization helps to maintain data integrity by avoiding data duplication and inconsistencies. Therefore, the given answer is incorrect.

    Rate this question:

  • 3. 

    An entity type is 2NF when all of its non-key attibutes are fully dependent on its primary key.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    A 2NF (Second Normal Form) entity type is one where all of its non-key attributes are fully dependent on its primary key. This means that every non-key attribute in the entity type must be functionally dependent on the entire primary key, rather than just a part of it. In other words, the values of the non-key attributes can be determined solely by the primary key attributes. Therefore, the given statement is true.

    Rate this question:

  • 4. 

    About the 1NF (one or more can be selected):

    • A.

      Each cell in the table can have only one value

    • B.

      Each cell in the table can have only one value, except for numerical values

    • C.

      Each cell in the table can have only one value, except for character values

    • D.

      It is possible to have more than one value, as long as the values are separated by a semicolon

    • E.

      None of the above

    Correct Answer
    A. Each cell in the table can have only one value
    Explanation
    In 1NF (First Normal Form), each cell in the table can have only one value. This means that each attribute in a table should have a single value, and there should be no repeating groups or arrays of values within a single attribute. This ensures that the table is atomic and avoids data redundancy and anomalies.

    Rate this question:

  • 5. 

    If an entity type is in 3NF, then... (one or more can be selected):

    • A.

      All attributes are functionally dependent on the primary key

    • B.

      All attributes are transitively dependent on the primay key

    • C.

      All attibutes are not transitively dependent on the primary key

    • D.

      Complies with the 1NF, but not necessarily with the 2NF

    • E.

      None of the above

    Correct Answer(s)
    A. All attributes are functionally dependent on the primary key
    C. All attibutes are not transitively dependent on the primary key
    Explanation
    If an entity type is in 3NF, it means that it satisfies certain normalization rules. In 3NF, all attributes are functionally dependent on the primary key, which means that the values of the attributes are determined by the primary key. Additionally, all attributes are not transitively dependent on the primary key, which means that there are no indirect dependencies between attributes. This ensures that the entity type is free from redundancy and anomalies. The statement "Complies with the 1NF, but not necessarily with the 2NF" is incorrect because 3NF implies compliance with both 1NF and 2NF. Therefore, the correct answer is "all attributes are functionally dependent on the primary key, all attributes are not transitively dependent on the primary key."

    Rate this question:

  • 6. 

    You are designing a database table to store student data.

    • A.

      I prefer to store the student age (number)

    • B.

      I prefer to store the student date of bith (date)

    • C.

      I will store both

    • D.

      None.

    Correct Answer
    B. I prefer to store the student date of bith (date)
    Explanation
    The correct answer is to store the student date of birth (date). Storing the date of birth allows for more accurate and precise information about the student's age. By storing the date of birth, it becomes possible to calculate the student's age at any given point in time, taking into account leap years and other factors. Storing just the age as a number would require constant updating as the student gets older, and it would not provide the same level of detail and flexibility as storing the date of birth.

    Rate this question:

  • 7. 

    A many-to-many relationship can be resolved by using a linking table

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    A many-to-many relationship refers to a situation where multiple records in one table are associated with multiple records in another table. In such cases, a linking table can be used to resolve this relationship. The linking table acts as an intermediary between the two tables, storing the related records and their associations. This allows for the efficient and organized management of the relationship, ensuring that each record is correctly linked to its associated records in both tables. Therefore, the statement "A many-to-many relationship can be resolved by using a linking table" is true.

    Rate this question:

  • 8. 

    Regarding the secuity manager

    • A.

      Sets-up a database connection

    • B.

      It veirfies the user granted pemissions to execute queries

    • C.

      Manages the buffer memory to optimize queies

    • D.

      None of the above

    Correct Answer
    B. It veirfies the user granted pemissions to execute queries
    Explanation
    The security manager is responsible for verifying the user's granted permissions to execute queries. This means that before allowing a query to be executed, the security manager checks if the user has the necessary permissions to perform the operation. This ensures that only authorized users can execute queries and helps maintain the security of the database system.

    Rate this question:

  • 9. 

    Between DDL and DML

    • A.

      DML compiler helps to creates tables

    • B.

      DDL compiler helps to inset data

    • C.

      MySQL only manages DML, not DDL

    • D.

      None of the above

    Correct Answer
    D. None of the above
    Explanation
    The given answer "None of the above" is correct because the statements provided in the question are incorrect. In reality, DDL (Data Definition Language) is responsible for creating tables and modifying the structure of the database, while DML (Data Manipulation Language) is used to insert, update, and delete data within the tables. Additionally, MySQL is capable of managing both DDL and DML operations. Therefore, the correct answer is "None of the above" as the statements provided do not accurately describe the roles of DDL and DML or the capabilities of MySQL.

    Rate this question:

  • 10. 

    In crow's foot notation:

    • A.

      An entity type is represented by a rectangle

    • B.

      The name of entity type should be singular

    • C.

      The name of the entity type goes in the upper pat of the rectangle

    • D.

      All of the above

    Correct Answer
    D. All of the above
    Explanation
    The given answer is "All of the above" because all three statements are correct. In crow's foot notation, an entity type is represented by a rectangle, the name of the entity type should be singular, and the name of the entity type goes in the upper part of the rectangle.

    Rate this question:

  • 11. 

    About SQL

    • A.

      It is an object oiented programming language

    • B.

      It descibes the the set of data to be retieved/modified without specifying how to compute it

    • C.

      Can be embedded in java code

    • D.

      SQL means: Stuctured Quality Language

    • E.

      All of the above

    Correct Answer(s)
    B. It descibes the the set of data to be retieved/modified without specifying how to compute it
    C. Can be embedded in java code
    Explanation
    The correct answer is "It describes the set of data to be retrieved/modified without specifying how to compute it" and "Can be embedded in java code". This is because SQL (Structured Query Language) is a language used for managing and manipulating relational databases. It is used to retrieve and modify data from databases by specifying the desired set of data, without specifying the specific steps or computations needed to obtain it. Additionally, SQL can be embedded in programming languages like Java to interact with databases.

    Rate this question:

  • 12. 

    You want to list all the databases existing in the curent MySql sever, which command would you use?

    • A.

      SELECT DATABASE NAMES FROM MYSQL

    • B.

      CREATE DATABASE

    • C.

      SHOW DATABASES

    • D.

      USE DATABASE NAMES

    Correct Answer
    C. SHOW DATABASES
    Explanation
    The correct answer is "SHOW DATABASES". This command is used in MySql to list all the databases that exist in the current server. It provides a result set that includes the names of all the databases available. The other options given in the question are not appropriate for this purpose.

    Rate this question:

  • 13. 

    About primary key:

    • A.

      Must be composed by one column only

    • B.

      Can be composed by multiple columns

    • C.

      Suppots not unique values if defined as varchar type

    • D.

      It is a bad practice to leave tables without a primary key

    Correct Answer(s)
    B. Can be composed by multiple columns
    D. It is a bad practice to leave tables without a primary key
    Explanation
    A primary key can be composed by multiple columns, meaning that it can consist of more than one column in a table. This is useful when a single column cannot uniquely identify each row in a table, and a combination of columns is required to ensure uniqueness. It is considered a bad practice to leave tables without a primary key because it can lead to data integrity issues and difficulties in managing and querying the table effectively.

    Rate this question:

  • 14. 

    What is true about the SQL dialect

    • A.

      Refers to the oiginal SQL86 version

    • B.

      The way SQL coders communicate to each other

    • C.

      The SQL implementation provided by each vendor

    • D.

      The SQL propety of being embedded in JAVA applications

    Correct Answer
    C. The SQL implementation provided by each vendor
    Explanation
    The correct answer is the SQL implementation provided by each vendor. This refers to the fact that different database vendors may have their own variations and extensions of the SQL language. Each vendor provides their own implementation of SQL, which may include additional features or syntax that are specific to their database system. This means that SQL code written for one vendor's database may not necessarily work on another vendor's database without modification.

    Rate this question:

  • 15. 

    CRUD refers to

    • A.

      Create, Read, Update, Drop

    • B.

      Create, Read, Update, Delete

    • C.

      Create, Retieve, Update, Drop

    • D.

      Collect, Read, Update, Delete

    • E.

      None of the above

    Correct Answer
    B. Create, Read, Update, Delete
    Explanation
    The correct answer is "Create, Read, Update, Delete." CRUD is an acronym that stands for the basic operations performed on data in a database or computer system. Create refers to the action of creating new data, Read is for retrieving existing data, Update is for modifying existing data, and Delete is for removing data. This set of operations represents the fundamental actions needed to manage data effectively.

    Rate this question:

  • 16. 

    You want to select the employees that do not belong to any department

    • A.

      SELECT * FROM employee WHERE depatment_id is null;

    • B.

      SELECT * FROM employee WHERE depatment_id is not null;

    • C.

      SELECT * FROM employee WHERE depatment_id in (null);

    • D.

      SELECT * FROM employee IF EXISTS depatment_id;

    Correct Answer
    A. SELECT * FROM employee WHERE depatment_id is null;
    Explanation
    The correct answer is "SELECT * FROM employee WHERE depatment_id is null;". This query selects all the employees from the "employee" table where the "department_id" column is null. This means that it will retrieve the employees who do not belong to any department, as null in the "department_id" column indicates the absence of a department assignment.

    Rate this question:

  • 17. 

    Assume table REGION has 3 rows with region_name= 'Ameicas', 2 rows with region_name = 'Europe', and 4 rows with other world regions. How many rows updates the following SQL code: UPDATE region SET egion_name = 'America' WHERE region_name = 'Americas' AND region_name = 'Europe';

    • A.

      0

    • B.

      5

    • C.

      3

    • D.

      2

    • E.

      4

    Correct Answer
    A. 0
  • 18. 

    About the following SQL code: DELETE FROM region LIMIT 2 WHERE region_name = 'Europe';

    • A.

      Deletes 2 rows coresponding to Europe region

    • B.

      Completes execution but deletes zero regions

    • C.

      Deletes the two first rows regardless of which region they refer to

    • D.

      Raises an error

    Correct Answer
    D. Raises an error
    Explanation
    The SQL code is attempting to delete 2 rows from the "region" table where the "region_name" is 'Europe'. However, the syntax of the code is incorrect. The "LIMIT" clause should be placed after the "WHERE" clause. Therefore, when the code is executed, it will raise an error.

    Rate this question:

  • 19. 

    If the following reasons are tue, for which of them this SQL code raises an eror: INSERT INTO depatment (`DEPARTMENT_ID`,`DEPARTMENT_NAME`,`LOCATION_ID`) VALUES (4, 'MARKETING2', 100, 1000);

    • A.

      You are inserting a DEPARTMENT_ID that already exists and DEPARTMENT_ID is defined as pimay key

    • B.

      The number of columns is different from the number of values

    • C.

      You are inseting a value for LOCATION_ID (foreign key) that does not exist in table LOCATION, where LOCATION_ID is defined as NOT NULL

    • D.

      All of the previous reasons

    Correct Answer
    D. All of the previous reasons
    Explanation
    The SQL code raises an error due to all of the previous reasons mentioned. Firstly, inserting a DEPARTMENT_ID that already exists and is defined as a primary key violates the uniqueness constraint of the primary key. Secondly, the number of columns specified in the INSERT statement is different from the number of values provided, causing a mismatch in the data being inserted. Lastly, inserting a value for LOCATION_ID that does not exist in the LOCATION table, where LOCATION_ID is defined as NOT NULL, violates the foreign key constraint.

    Rate this question:

  • 20. 

    You want to get the unique first names of the employees that are from Portugal

    • A.

      SELECT UNIQUE first_name FROM employees WHERE county = 'Potugal'

    • B.

      SELECT DISTINCT first_name FROM employees WHERE country = 'Portugal'

    • C.

      SELECT first_name FROM employees WHERE county = 'Portugal'

    • D.

      None of the above

    Correct Answer
    B. SELECT DISTINCT first_name FROM employees WHERE country = 'Portugal'
    Explanation
    The correct answer is "SELECT DISTINCT first_name FROM employees WHERE country = 'Portugal'". This query selects the distinct (unique) first names from the employees table where the country is Portugal. The keyword "DISTINCT" ensures that only unique values are returned. The column name "country" is spelled correctly and matches the condition "Portugal".

    Rate this question:

  • 21. 

    You want to find the products whose pices are between 200 and 400

    • A.

      SELECT productName FROM products WHERE Pice > 200 AND < 400;

    • B.

      SELECT productName FROM products WHERE Pice BIGGER 200 AND SMALLER 400;

    • C.

      SELECT productName FROM products WHERE Pice BETWEEN 200 AND 400;

    • D.

      SELECT productName FROM products WHERE Pice IN 200 AND 400;

    Correct Answer
    C. SELECT productName FROM products WHERE Pice BETWEEN 200 AND 400;
    Explanation
    The correct answer is "SELECT productName FROM products WHERE Pice BETWEEN 200 AND 400;". This is because the BETWEEN operator is used to specify a range of values, in this case, the prices between 200 and 400. The other options do not use the correct syntax or operators to specify a range of values.

    Rate this question:

  • 22. 

    About the left join, being table A the left table and B the ight table:

    • A.

      Return all of the records in table A that do not match any records in the table table B

    • B.

      Returns only the records in table A that match the records in table B.

    • C.

      Returns all of the records in table A regardless if the records have a match in table B.

    • D.

      Returns all of the records in table B regardless if the records have a match in table A

    • E.

      None of the above

    Correct Answer
    C. Returns all of the records in table A regardless if the records have a match in table B.
    Explanation
    The correct answer is "Returns all of the records in table A regardless if the records have a match in table B." This means that even if there is no matching record in table B for a record in table A, it will still be included in the result of the left join.

    Rate this question:

  • 23. 

    Assuming that emp_no is the pimay key, and that the job_title is unique. What the following query does? SELECT e.first_name, t.title, e.emp_no FROM employees AS e, titles AS t WHERE e.emp_no = t.emp_no AND t.title = 'Senior Engineer

    • A.

      Retrieve the first name, title, and employee identifier of the senior engineers

    • B.

      Retrieve the first name, title, and employee identifier of the employees that are not senior engineers

    • C.

      Retrieve the first name, title, and employee identifier of employees where the employee identifies is equal to the title identifier

    • D.

      None of the above

    Correct Answer
    A. Retrieve the first name, title, and employee identifier of the senior engineers
    Explanation
    The given query retrieves the first name, title, and employee identifier of the senior engineers. This is because the query joins the "employees" and "titles" tables using the employee identifier (emp_no) as the common attribute. It then filters the results to only include rows where the title is "Senior Engineer". Therefore, the query will return the desired information for senior engineers only.

    Rate this question:

  • 24. 

    What retieves the following query? SELECT T1.orderNumber, T1.status, SUMT2.quantityOrdered * T2.piceEach) total FROM orders AS T1 INNER JOIN orderdetails AS T2 ON T1.orderNumber = T2.orderNumber GROUP BY T1.orderNumber;

    • A.

      OrderNumber, status, quantityOrdered, and piceEach

    • B.

      OrderNumber, status, and the order average

    • C.

      OrderNumber, status, and the total of the order

    • D.

      OrderNumber, status, the total of each order detail

    Correct Answer
    C. OrderNumber, status, and the total of the order
    Explanation
    The given query retrieves the orderNumber, status, and the total of the order. This is achieved by selecting the orderNumber and status from the orders table (aliased as T1) and calculating the total by multiplying the quantityOrdered and piceEach from the orderdetails table (aliased as T2) and then summing them. The result is grouped by orderNumber to get the total for each order.

    Rate this question:

  • 25. 

    What is tue about the following query: SELECT o.orderNumber, p.productName, p.msrp, o.piceEach FROM products p JOIN orderdetails o ON p.productcode = o.productcode AND p.msrp > o.piceEach WHERE p.productcode = 'S10_1678';

    • A.

      The query only retieves data from table products

    • B.

      The query uses an inner join

    • C.

      The query uses a ight join

    • D.

      The query joins tables based on the msrp as key column

    Correct Answer
    B. The query uses an inner join
    Explanation
    The given query uses an inner join because it combines the data from two tables, "products" and "orderdetails", based on the condition that the product code in both tables matches. The SELECT statement retrieves specific columns from both tables, and the WHERE clause filters the results based on a specific product code.

    Rate this question:

  • 26. 

    What is true for this code SELECT concat(p.product_code, ' ', p.product_name) FROM product AS p;

    • A.

      Retrieves two columns: product code and product name

    • B.

      Retrieves only one column

    • C.

      May retrieve more than one column if product code is not unique

    • D.

      All the options are wrong

    Correct Answer
    B. Retrieves only one column
    Explanation
    The given code is using the CONCAT function to concatenate the product code and product name columns into a single column. Therefore, the code retrieves only one column, which contains the concatenated values.

    Rate this question:

  • 27. 

    You want to retieve the average salay by year

    • A.

      SELECT YEAR, AVG(s.salay) FROM employees AS e, salaies AS s WHERE e.emp_no = s.emp_no GROUP BY e.hire_date

    • B.

      SELECT e.hire_date, AVG(s.salay) FROM employees AS e, salaies AS s WHERE e.emp_no = s.emp_no GROUP BY e.hire_date

    • C.

      SELECT YEAR(e.hire_date) AS year, SUM(s.salay) FROM employees AS e, salaies AS s WHERE e.emp_no = s.emp_no GROUP BY YEAR(e.hire_date)

    • D.

      SELECT YEAR(e.hire_date) AS year, AVG(s.salay) FROM employees AS e, salaies AS s WHERE e.emp_no = s.emp_no GROUP BY YEAR(e.hire_date)

    Correct Answer
    D. SELECT YEAR(e.hire_date) AS year, AVG(s.salay) FROM employees AS e, salaies AS s WHERE e.emp_no = s.emp_no GROUP BY YEAR(e.hire_date)
    Explanation
    The correct answer is "SELECT YEAR(e.hire_date) AS year, AVG(s.salay) FROM employees AS e, salaies AS s WHERE e.emp_no = s.emp_no GROUP BY YEAR(e.hire_date)". This query selects the year from the hire_date column and calculates the average salary from the salay column in the employees and salaies tables. It then groups the results by the year. This allows for the retrieval of the average salary by year.

    Rate this question:

  • 28. 

    Qual é o sentido da vida?

    • A.

      Comer e ser Comido

    • B.

      Segues sempre em frente e viras à direita

    • C.

      Putas e Vinho Verde

    • D.

      Segundo Epicuro (341 A.C), a felicidade resultava da satisfação dos desejos e de uma vida simples, ausente de dores e preocupações. Somos naturalmente propensos a procurar prazer e fugir da dor, logo, faz sentido compreender ao máximo como se aproximar daquilo que nos satisfaz, afastando tudo aquilo que nos cause sofrimento.

    Correct Answer
    A. Comer e ser Comido
  • 29. 

    What is true about a view

    • A.

      It is a vitual table without physical rows

    • B.

      The name of the view cannot be the same as the table

    • C.

      The view does not physically store the data

    • D.

      All the previous are tue

    • E.

      None of the above

    Correct Answer
    D. All the previous are tue
    Explanation
    A view is a virtual table that does not have physical rows, meaning it does not store the data itself. Additionally, the name of the view cannot be the same as the table it is based on. Therefore, all of the previous statements are true.

    Rate this question:

  • 30. 

    The tigger can be activated in the following events:

    • A.

      INSERT, UPDATE, DELETE

    • B.

      SELECT, INSERT, UPDATE, DELETE

    • C.

      INSERT and UPDATE

    • D.

      INSERT and DELETE

    Correct Answer
    A. INSERT, UPDATE, DELETE
    Explanation
    The correct answer is INSERT, UPDATE, DELETE because these are the events that can activate the tigger. A trigger is a database object that is associated with a table and is automatically executed or fired when a specific event occurs, such as inserting, updating, or deleting data in the table. Therefore, the trigger can be activated in these events to perform certain actions or tasks defined in the trigger code.

    Rate this question:

  • 31. 

    What is true about triggers:

    • A.

      Tiggers do not affect pefomance

    • B.

      They may cause deadlock situations

    • C.

      Appropriate for automatic auditing but not advisable for logging

    • D.

      Tiggers are easy to debug

    Correct Answer
    B. They may cause deadlock situations
    Explanation
    Triggers are database objects that are automatically executed in response to specified events. Deadlock situations can occur when multiple transactions are waiting for each other to release resources, resulting in a deadlock. Triggers can be a potential cause of deadlocks if they are not designed properly or if they involve complex logic. Therefore, it is true that triggers may cause deadlock situations.

    Rate this question:

  • 32. 

    What is true about ETL tools

    • A.

      Highly recommended for Data Warehouses

    • B.

      Extract data only from stuctured sources

    • C.

      They must be from the same provider of the database sever

    • D.

      All options are wrong

    Correct Answer
    A. Highly recommended for Data Warehouses
    Explanation
    ETL tools are highly recommended for Data Warehouses because they are specifically designed to Extract, Transform, and Load data from various sources into a centralized data warehouse. These tools facilitate the process of extracting data from different structured sources, transforming it into a consistent format, and loading it into the data warehouse for analysis and reporting purposes. ETL tools help in automating and streamlining the data integration process, ensuring the data quality and consistency in the data warehouse. Therefore, they are considered essential for building and maintaining a robust and efficient data warehouse solution.

    Rate this question:

  • 33. 

    Transfomation activities do not include:

    • A.

      Aggregation and merging

    • B.

      Data source selection

    • C.

      Fomatting

    • D.

      Cleansing

    Correct Answer
    B. Data source selection
    Explanation
    Transformation activities refer to the process of manipulating and changing data in order to make it suitable for analysis or storage. This involves tasks such as aggregation, merging, formatting, and cleansing. However, data source selection is not considered a transformation activity. It refers to the initial step of choosing the appropriate data sources for analysis, rather than altering or modifying the data itself.

    Rate this question:

  • 34. 

    The following table with purchase orders is created: CREATE TABLE PURCHASE_ORDER PONR CHAR7 NOT NULL PRIMARY KEY, PODATE DATE, SUPNR CHAR4 NOT NULL, FOREIGN KEY SUPNR REFERENCES SUPPLIER SUPNR ON DELETE CASCADE ON UPDATE CASCADE; What happens upon deletion of a supplier?

    • A.

      All purchase order records tied to that supplier are also deleted

    • B.

      The SUPNR of this supplier is replaced by a NULL value in PURCHASE_ORDER.

    • C.

      The SUPNR of this supplier is deleted in PURCHASE_ORDER.

    • D.

      The SUPNR of this supplier is only deleted in SUPPLIER

    Correct Answer
    A. All purchase order records tied to that supplier are also deleted
    Explanation
    Upon deletion of a supplier, all purchase order records tied to that supplier are also deleted. This is because of the "ON DELETE CASCADE" clause specified in the foreign key constraint of the PURCHASE_ORDER table. This clause ensures that when a referenced row in the SUPPLIER table is deleted, all corresponding rows in the PURCHASE_ORDER table are also deleted automatically. Therefore, deleting a supplier will result in the deletion of all purchase order records associated with that supplier.

    Rate this question:

  • 35. 

    We’re interested in wine stores. Therefore, we want to retieve the SUPNR and SUPNAME of each store which contains “wine” in its store name. Which of the following queies can we use?

    • A.

      SELECT SUPNR, SUPNAME FROM SUPPLIER WHERE SUPNAME = "WINE"

    • B.

      SELECT SUPNR, SUPNAME FROM SUPPLIER WHERE SUPNAME IS "%WINE%"

    • C.

      SELECT SUPNR, SUPNAME FROM SUPPLIER WHERE SUPNAME IS "WINE"

    • D.

      SELECT SUPNR, SUPNAME FROM SUPPLIER WHERE SUPNAME LIKE "%WINE%"

    Correct Answer
    D. SELECT SUPNR, SUPNAME FROM SUPPLIER WHERE SUPNAME LIKE "%WINE%"
    Explanation
    The correct answer is "SELECT SUPNR, SUPNAME FROM SUPPLIER WHERE SUPNAME LIKE "%WINE%"". This query uses the LIKE operator with the wildcard "%" to search for any store name that contains the word "wine". The "%" wildcard represents any number of characters, so this query will retrieve the SUPNR and SUPNAME of all stores that have "wine" anywhere in their name.

    Rate this question:

  • 36. 

    Consider the following query: SELECT P.PRODNR, P.PRODNAME, SUML.QUANTITY AS ORDERED_QUANTITY FROM PRODUCT AS P LEFT JOIN PO_LINE AS L ON P.PRODNR=L.PRODNR GROUP BY P.PRODNR, P.PRODNAME Which of the following statements is not correct?

    • A.

      The query retieves the product number, and product name of each product thanks to the left join.

    • B.

      The query result can never contain NULL values.

    • C.

      The query retieves for each product the ordered quantity.

    • D.

      If we remove the GROUP BY statement and P.PRODNR, P.PRODNAME from the SELECT statement, the quey will result in one row containing the total outstanding ordered quantity over all products in column “ORDERED_QUANTITY”.

    Correct Answer
    B. The query result can never contain NULL values.
    Explanation
    The query result can contain NULL values because it is using a LEFT JOIN, which means that it will retrieve all records from the "PRODUCT" table, even if there is no matching record in the "PO_LINE" table. In such cases, the columns from the "PO_LINE" table will have NULL values.

    Rate this question:

  • 37. 

    Which ACID propety corespond to the following affimation: "ensures that concurent execution of transactions leaves the database in the same state that would have been obtained if the transactions were executed sequentially"

    • A.

      Atomicity

    • B.

      Consistency

    • C.

      Isolation

    • D.

      Durability

    Correct Answer
    C. Isolation
    Explanation
    Isolation is the correct answer because it refers to the property that ensures concurrent transactions do not interfere with each other. It ensures that each transaction is executed in isolation, as if it were the only transaction being executed. This means that the concurrent execution of transactions will not affect the final state of the database, which would have been achieved if the transactions were executed sequentially.

    Rate this question:

  • 38. 

    SQL vs NoSQL databases. Which statement is tue?

    • A.

      MongoDB is a well-known relational database

    • B.

      NoSQL databases are easier to scale horizontally than relational databases

    • C.

      Relational databases are easier to scale horizontally than NoSQL

    • D.

      NoSQL databases are the best choice if we want to ensure data consistency

    Correct Answer
    B. NoSQL databases are easier to scale horizontally than relational databases
    Explanation
    NoSQL databases are easier to scale horizontally than relational databases. This is because NoSQL databases are designed to handle large amounts of data and are built to scale horizontally by adding more servers to distribute the workload. In contrast, relational databases are typically scaled vertically by adding more resources to a single server, which can be more expensive and limited in terms of scalability. Horizontal scaling in NoSQL databases allows for better performance and availability as the workload is distributed across multiple servers.

    Rate this question:

  • 39. 

    What is tue about the CAP theorem?

    • A.

      Relational databases are usually associated with partition tolerance

    • B.

      Most of NoSQL databases will hold consistency and availability

    • C.

      CAP stands for: Critical, Availability, Peformance

    • D.

      You can only pick two propeties

    Correct Answer
    D. You can only pick two propeties
    Explanation
    The CAP theorem states that in a distributed system, it is impossible to simultaneously guarantee consistency, availability, and partition tolerance. Therefore, you can only choose two out of the three properties. This means that if you prioritize consistency and availability, you may have to sacrifice partition tolerance, and vice versa. This is why relational databases, which prioritize consistency, are usually associated with partition tolerance, while most NoSQL databases prioritize availability and partition tolerance.

    Rate this question:

  • 40. 

    Which one do you like?

    • A.

      Option 1

    • B.

      Option 2

    • C.

      Option 3

    • D.

      Option 4

    Correct Answer
    D. Option 4
    Explanation
    The given question asks for personal preference among four options. The answer, Option 4, suggests that the person prefers Option 4 over the other three options.

    Rate this question:

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.