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?
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.
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?
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.
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?
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.
4.
4. Cuáles de las siguientes sentencias son ciertas sobre las vistas?
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.
5.
5. Qué establece un primary key de una tabla?
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.
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
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.
7.
7. Cuál de las siguientes setencias es cierta sobre las relaciones?
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.
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?
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.
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?
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.
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
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.
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?
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.
12.
12. Que tipo de LOCK(bloqueo) no permitira a los usuarios cualquier tipo de acceso a una tabla?
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.
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?
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.
14.
14. El left outer join es un tipo de outer join; otro tipo de outer join sería?
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.
15.
15. Algunas veces la sentencia "SELECT COUNT(*)" puede retornar menos filas que la sentencia "SELECT COUNT(nombre_columna)"?
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.
16.
16. Se requiere insertar el valor de "Pedro" en la columna LAST_NAME de la tabla PERSONAS, Cuál sentencia utilizaría?
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.
17.
17. Cuáles de las siguientes sentencias es verdad acerca del truncate?
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.