Examen SQL

By Cristina Medina
Cristina Medina, QA and Testing
Cristina, a seasoned QA Engineer with nineteen years of experience in object-oriented software, thrives on continuous learning and collaborative teamwork. Her expertise ensures the quality and efficiency of software development processes.
Quizzes Created: 2 | Total Attempts: 23,009
, QA and Testing
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
preguntas: 17 | Attempts: 13,343

SettingsSettingsSettings
Examen SQL - Quiz

Permite evaluar su nivel en sql básico. Es indispensable que ingrese su nombre completo para poder seguir con su proceso, de otra forma su prueba no tendra validez.Piense bien su respuesta ya que no podra regresar a revisar las mismas. Su tiempo para la prueba es de 40 minutos.


Questions and Answers
  • 1. 

    1. Se requiere pasar los datos desde una tabla que se encuentra en una base de datos oracle hacia una tabla con la misma estructura pero que se encuentra en sql-server, que herramienta utilizaria?

    • A.

      Bcp

    • B.

      SELECT... INTO

    • C.

      IMP

    • D.

      INSERT... INTO

    Correct Answer
    A. Bcp
    Explanation
    The correct answer is bcp. BCP (Bulk Copy Program) is a command-line utility in SQL Server that allows for the bulk import or export of data between SQL Server databases and other data sources. In this scenario, where data needs to be transferred from an Oracle database to a SQL Server database, BCP would be the appropriate tool to use as it supports the transfer of data between different database management systems.

    Rate this question:

  • 2. 

    2. Como dueño de la base de datos, usted da permisos Franz para crear vistas y procedimientos almacenados en la base de datos de Finanzas. Franz crea un procedimiento almacenado que realiza un update a la tabla precios. El crea luego una vista que selecciona los datos de esa tabla para generar un reporte. El le da a Suzanne permiso de SELECT sobre la vista y permiso de EXECUTE sobre el procedimiento almacenado. Que tarea adicional hay que realizar para que Suzanne pueda obtener los resultados requeridos usando la vista y procedimiento almacenado?

    • A.

      Usted debe dar permisos de SELECT a Suzanne sobre la vista y el procedimiento almacenado.

    • B.

      Franz debe dar a Suzanne permiso de SELECT sobre la tabla de precios.

    • C.

      Usted debe dar permisos de SELECT y UPDATE a Suzanne sobre la tabla de precios

    • D.

      Franz debe dar permisos de EXECUTE a Suzanne sobre el procedimiento almacenado y permisos de SELECT sobre la tabla de precios.

    Correct Answer
    C. Usted debe dar permisos de SELECT y UPDATE a Suzanne sobre la tabla de precios
    Explanation
    The correct answer is that you need to give Suzanne SELECT and UPDATE permissions on the prices table. This is because Suzanne needs to be able to both retrieve data from the table using the view created by Franz and also modify the data in the table through the stored procedure created by Franz. Without both SELECT and UPDATE permissions on the prices table, Suzanne will not be able to obtain the required results using the view and stored procedure.

    Rate this question:

  • 3. 

    3. Usted esta diseñando un modelo de datos en la cual la tabla de Clientes contiene un atributo que identifica el codigo del empleado el cual esta dedicado únicamente a la identificación de esa tabla, que regla de normalización viola este modelo?

    • A.

      Primera forma normal

    • B.

      Segunda forma normal

    • C.

      Tercera forma normal

    • D.

      Ninguna

    Correct Answer
    D. Ninguna
    Explanation
    This model does not violate any normalization rule. The attribute in the Clients table that identifies the employee code is solely dedicated to the identification of that table and does not cause any redundancy or dependency issues. Therefore, it is already in compliance with the normalization rules and does not violate any of them.

    Rate this question:

  • 4. 

    4. Cuáles de las siguientes sentencias son ciertas sobre las vistas?

    • A.

      Una vista representa un subconjunto de los atributos de una tabla y que puede ser diseñado para facilitar un caso en particular.

    • B.

      El manejo de permisos y otras tareas administrativas es mucho mas fácil a través de vistas que a través de tablas.

    • C.

      Una vista es utilizada para recuperación rápida de datos.

    • D.

      Una vista es una rápida descripción de una base de datos.

    Correct Answer(s)
    A. Una vista representa un subconjunto de los atributos de una tabla y que puede ser diseñado para facilitar un caso en particular.
    B. El manejo de permisos y otras tareas administrativas es mucho mas fácil a través de vistas que a través de tablas.
    Explanation
    A view represents a subset of the attributes of a table and can be designed to facilitate a particular use case. It allows for easier management of permissions and other administrative tasks compared to tables. A view is not used for quick data retrieval and it is not a quick description of a database.

    Rate this question:

  • 5. 

    5. Qué establece un primary key de una tabla?

    • A.

      Integridad Referencial

    • B.

      Integridad de los registros

    • C.

      Integridad de las columnas

    • D.

      Constrainsts de identidad

    Correct Answer
    B. Integridad de los registros
    Explanation
    Un primary key de una tabla establece la integridad de los registros. Esto significa que cada registro en la tabla debe tener un valor único en la columna que se ha designado como primary key. Esto garantiza que no haya registros duplicados en la tabla y ayuda a mantener la consistencia y la integridad de los datos almacenados en la misma.

    Rate this question:

  • 6. 

    6. Usted tiene dos tablas, PURCHASEORDERHEADER y PURCHASEORDERLINE,(el detalle de las tablas s encuentra abajo). La tabla PURCHASEORDERHEADER almacenará información sobre la orden de compra, mientras que la tabla PURCHASEORDERLINE almacenera información sobre el detalle de los productos. Basado en la información dada, como se establecerá una relación entre estas dos tablas?Tabla: PURCHASEORDERHEADER-----------------------------------------------------order_id*order_noorder_datesupplier_idTabla: PURCHASEORDERLINE -----------------------------------------------------line_id*s_noproduct_id

    • A.

      Crear un primary key en ambas tablas y formar una relación uno a uno entre las mismas.

    • B.

      Crear un foreign key en la tabla PURCHASEORDERLINE que referencie al primary key de la tabla PURCHASEORDERHEADER

    • C.

      Crear un primary key en PURCHASEORDERLINE que es referenciado por el foreign key de la tabla PURCHASEORDERHEADER

    • D.

      Crear una tercera tabla que será usada para relacionar las dos tablas usando foreign keys.

    Correct Answer
    B. Crear un foreign key en la tabla PURCHASEORDERLINE que referencie al primary key de la tabla PURCHASEORDERHEADER
    Explanation
    The correct answer is to create a foreign key in the PURCHASEORDERLINE table that references the primary key of the PURCHASEORDERHEADER table. This means that the line items in the PURCHASEORDERLINE table will be linked to the corresponding purchase order in the PURCHASEORDERHEADER table. This allows for a one-to-many relationship, where one purchase order can have multiple line items.

    Rate this question:

  • 7. 

    7. Cuál de las siguientes setencias es cierta sobre las relaciones?

    • A.

      Las relaciones son entidades

    • B.

      Las relaciones son enlaces lógicos entre las tablas implementadas a través de primary y foreign keys.

    • C.

      Las relaciones son almacendas como atributos en la base de datos.

    • D.

      Las relaciones explicitamente definen una asociación entre 2 tablas.

    Correct Answer(s)
    B. Las relaciones son enlaces lógicos entre las tablas implementadas a través de primary y foreign keys.
    D. Las relaciones explicitamente definen una asociación entre 2 tablas.
    Explanation
    Las relaciones son enlaces lógicos entre las tablas implementadas a través de primary y foreign keys. Esto significa que las relaciones establecen una conexión entre dos tablas en una base de datos mediante el uso de claves primarias y claves foráneas. Esto permite que los datos de una tabla se relacionen y se vinculen con los datos de otra tabla de manera lógica y coherente. Además, las relaciones también definen explícitamente una asociación entre dos tablas, lo que ayuda a mantener la integridad y consistencia de los datos en la base de datos.

    Rate this question:

  • 8. 

    8. Usted tiene 3 tablas Authors, Books y Titleauthor en su base de datos. La tabla Titleauthor es usada para definir una relación muchos a muchos entre las tablas Authors y Books. Cuál  de las siguientes sentencias SQL  SELECT muestran el title_id de los libros que tienen mas de un autor?

    • A.

      SELECT DISTINCT t1.title_id FROM titleauthor t1, titleauthor t2 WHERE t1.titleauthor_id = t2.titleauthor_id AND t1.au_id t2.au_id

    • B.

      SELECT DISTINCT title_id FROM titleauthor WHERE title_id(1)= title_id(2) AND au_id(1) au_id(2)

    • C.

      SELECT DISTINCT title_id FROM titleauthor WHERE title_id = title_id AND au_id au_id

    • D.

      SELECT DISTINCT t1.title_id FROM titleauthor t1, titleauthor t2 WHERE t1.title_id = t2.title_id AND t1.au_id t2.au_id

    Correct Answer
    D. SELECT DISTINCT t1.title_id FROM titleauthor t1, titleauthor t2 WHERE t1.title_id = t2.title_id AND t1.au_id t2.au_id
    Explanation
    The correct answer is the first option: SELECT DISTINCT t1.title_id FROM titleauthor t1, titleauthor t2 WHERE t1.title_id = t2.title_id AND t1.au_id < t2.au_id. This query joins the table "titleauthor" with itself using aliases t1 and t2, and compares the author IDs (au_id) to find cases where t1 has a lower ID than t2. This condition ensures that only title IDs with more than one author are selected. The DISTINCT keyword is used to remove any duplicate title IDs from the result set.

    Rate this question:

  • 9. 

    9. Su supervisor de Ventas quiere un reporte que muestre los primeros cinco peores vendedores. Cuál de las siguientes setencias producirá el resultado deseado?

    • A.

      SELECT TOP 5 SalesPersonaID, SUM(OrderAmount) FROM SalesOrders ORDER BY OrderAmount DESC

    • B.

      SELECT TOP 5 SalesPersonaID, SUM(OrderAmount) FROM SalesOrders GROUP BY SalesPersonaID ORDER BY SUM(OrderAmount)

    • C.

      SELECT TOP 5 SalesPersonaID, OrderAmount FROM SalesOrders GROUP BY SalesPersonaID

    • D.

      SELECT DISTINCT TOP 5 SalesPersonaID, OrderAmount FROM SalesOrders ORDER BY OrderAmount ASC

    Correct Answer
    B. SELECT TOP 5 SalesPersonaID, SUM(OrderAmount) FROM SalesOrders GROUP BY SalesPersonaID ORDER BY SUM(OrderAmount)
    Explanation
    This query will produce the desired result because it selects the top 5 SalesPersonaID and the sum of their OrderAmount from the SalesOrders table. It groups the results by SalesPersonaID to ensure that each individual salesperson's total order amount is considered. Finally, it orders the results by the sum of OrderAmount in descending order, which will display the first five worst salespeople.

    Rate this question:

  • 10. 

    10. Usted tiene una tabla que guarda el saldo de la factura y otra tabla de facturas, cuyo detalle se muestra abajo, se requiere realizar un UPDATE de la tabla de saldo de facturas, del campo saldo igual al campo valor_factura, tomando en cuenta las facturas cuya fecha de vencimiento no sea mayor que la fecha actual. Escriba la sentencia que utilizaría?RE_SALDO_FACTURA----------------------------------RE_SALDO_FACTURAnum_facturacod_clientesaldofecha_corteRE_FACTURA-----------------------cod_empresanum_facturacod_clientefecha_facturafecha_vencimientovalor_factura

    • A.

      UPDATE RE_SALDO_FACTURA SET saldo = ( SELECT valor_factura FROM RE_FACTURA WHERE fecha_vencimiento < GETDATE()) WHERE RE_SALDO_FACTURA.cod_empresa = RE_FACTURA.cod_empresa AND RE_SALDO_FACTURA.num_factura = RE_FACTURA.num_factura AND RE_SALDO_FACTURA.cod_cliente = RE_FACTURA.cod_cliente

    • B.

      UPDATE RE_SALDO_FACTURA SET saldo = ( SELECT valor_factura FROM RE_FACTURA WHERE RE_SALDO_FACTURA.cod_empresa = RE_FACTURA.cod_empresa AND RE_SALDO_FACTURA.num_factura = RE_FACTURA.num_factura AND RE_SALDO_FACTURA.cod_cliente = RE_FACTURA.cod_cliente AND fecha_vencimiento < GETDATE())

    • C.

      UPDATE saldo = valor_factura FROM RE_FACTURA, RE_SALDO_FACTURA WHERE RE_SALDO_FACTURA.cod_empresa = RE_FACTURA.cod_empresa AND RE_SALDO_FACTURA.num_factura = RE_FACTURA.num_factura AND RE_SALDO_FACTURA.cod_cliente = RE_FACTURA.cod_cliente AND fecha_vencimiento < GETDATE()

    • D.

      UPDATE RE_SALDO_FACTURA A SET saldo = ( SELECT valor_factura FROM RE_FACTURA B WHERE A.cod_empresa = B.cod_empresa AND A.num_factura = B.num_factura AND A.cod_cliente = B.cod_cliente AND fecha_vencimiento < GETDATE())

    Correct Answer
    B. UPDATE RE_SALDO_FACTURA SET saldo = ( SELECT valor_factura FROM RE_FACTURA WHERE RE_SALDO_FACTURA.cod_empresa = RE_FACTURA.cod_empresa AND RE_SALDO_FACTURA.num_factura = RE_FACTURA.num_factura AND RE_SALDO_FACTURA.cod_cliente = RE_FACTURA.cod_cliente AND fecha_vencimiento < GETDATE())
    Explanation
    The correct answer is the third option: "UPDATE saldo = valor_factura FROM RE_FACTURA, RE_SALDO_FACTURA WHERE RE_SALDO_FACTURA.cod_empresa = RE_FACTURA.cod_empresa AND RE_SALDO_FACTURA.num_factura = RE_FACTURA.num_factura AND RE_SALDO_FACTURA.cod_cliente = RE_FACTURA.cod_cliente AND fecha_vencimiento < GETDATE()". This statement updates the "saldo" field in the "RE_SALDO_FACTURA" table with the "valor_factura" from the "RE_FACTURA" table, only for the rows where the "fecha_vencimiento" is earlier than the current date. It uses a join between the two tables to match the relevant rows.

    Rate this question:

  • 11. 

    11. El operador OR despliega registros si es que cualquiera de las condiciones son verdaderas. El operador AND despliega registros si todas las condiciones son verdaderas?

    • A.

      VERDADERO

    • B.

      FALSO

    Correct Answer
    A. VERDADERO
    Explanation
    The statement is true. The OR operator in programming displays records if any of the conditions are true. On the other hand, the AND operator displays records only if all the conditions are true. Therefore, the statement accurately describes the behavior of these operators.

    Rate this question:

  • 12. 

    12. Que tipo de LOCK(bloqueo) no permitira a los usuarios cualquier tipo de acceso a una tabla?

    • A.

      EXPLICIT

    • B.

      IMPLICIT

    • C.

      EXCLUSIVE

    • D.

      SHARED

    • E.

      READ ONLY

    Correct Answer
    C. EXCLUSIVE
    Explanation
    An exclusive lock does not allow any type of access to a table by other users. This means that when a user holds an exclusive lock on a table, other users are not able to read, write, or modify the table until the lock is released.

    Rate this question:

  • 13. 

    13. Considere el siguiente SELECT:SELECT item_no FROM ITEM WHERE expiry_date = (SELECT order_date FROM ORDER WHERE item_no =2)¿Cuál de las siguientes sentencias es verdad?

    • A.

      El select anidado retornara la fecha de la orden del ítem numero dos al select principal.

    • B.

      El select anidado retornara un error.

    • C.

      El select principal retornara el numero de ítem para aquellos ítems cuya fecha de expiración es la misma que la fecha de la orden para ítem numero 2

    • D.

      El select principal retornara un error.

    Correct Answer(s)
    A. El select anidado retornara la fecha de la orden del ítem numero dos al select principal.
    D. El select principal retornara un error.
    Explanation
    The nested SELECT statement in the given query will return the order date for item number 2 to the main SELECT statement. However, the main SELECT statement will return an error because it is trying to compare the expiry date of items with the order date of item number 2, which is not a valid comparison.

    Rate this question:

  • 14. 

    14. El left outer join es un tipo de outer join; otro tipo de outer join sería?

    • A.

      Right

    • B.

      Full

    • C.

      Right outer

    • D.

      Full outer

    • E.

      Todas las anteriores

    Correct Answer
    E. Todas las anteriores
    Explanation
    The correct answer is "Todas las anteriores" (All of the above). This is because the left outer join is a type of outer join, and the other options listed (right, full, right outer, and full outer) are also types of outer joins. Therefore, all of the options mentioned are correct.

    Rate this question:

  • 15. 

    15. Algunas veces la sentencia "SELECT COUNT(*)" puede retornar menos filas que la sentencia "SELECT COUNT(nombre_columna)"? 

    • A.

      VERDADERO

    • B.

      FALSO

    Correct Answer
    B. FALSO
    Explanation
    La sentencia "SELECT COUNT(*)" siempre retorna el número total de filas en una tabla, mientras que la sentencia "SELECT COUNT(nombre_columna)" retorna el número de filas donde la columna especificada no es nula. Por lo tanto, la sentencia "SELECT COUNT(nombre_columna)" puede retornar menos filas que la sentencia "SELECT COUNT(*)" si hay filas en la tabla donde la columna especificada es nula.

    Rate this question:

  • 16. 

    16. Se requiere insertar el valor de "Pedro" en la columna  LAST_NAME de la tabla PERSONAS, Cuál sentencia utilizaría?

    • A.

      INSERT INTO PERSONAS (LAST_NAME) VALUES ('Pedro')

    • B.

      INSERT ('Pedro') INTO PERSONAS (LAST_NAME)

    • C.

      INSERT INTO PERSONAS ('Pedro') INTO LAST_NAME

    Correct Answer
    A. INSERT INTO PERSONAS (LAST_NAME) VALUES ('Pedro')
    Explanation
    The correct answer is "INSERT INTO PERSONAS (LAST_NAME) VALUES ('Pedro')". This is the correct syntax for inserting a value into a specific column in a table. The "INSERT INTO" statement is used to specify the table name and column names, followed by the "VALUES" keyword to specify the value to be inserted. In this case, the value 'Pedro' is being inserted into the LAST_NAME column of the PERSONAS table.

    Rate this question:

  • 17. 

    17. Cuáles de las siguientes sentencias es verdad acerca del truncate?

    • A.

      TRUNCATE TABLE, borra la tabla de la base de datos

    • B.

      TRUNCATE TABLE es funcionalmente igual a DELETE TABLE

    • C.

      TRUNCATE TABLE debe ser usado con la cláusula WHERE

    Correct Answer
    B. TRUNCATE TABLE es funcionalmente igual a DELETE TABLE
    Explanation
    TRUNCATE TABLE is functionally equivalent to DELETE TABLE. This means that both commands can be used to remove all the data from a table. However, there are some differences between them. TRUNCATE TABLE is faster and uses fewer system resources compared to DELETE TABLE because it does not generate any transaction logs. Additionally, TRUNCATE TABLE cannot be used with a WHERE clause, whereas DELETE TABLE allows for filtering based on specific conditions.

    Rate this question:

Cristina Medina |QA and Testing
Cristina, a seasoned QA Engineer with nineteen years of experience in object-oriented software, thrives on continuous learning and collaborative teamwork. Her expertise ensures the quality and efficiency of software development processes.

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 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Oct 16, 2009
    Quiz Created by
    Cristina Medina
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.