Font size
WorksheetsDBI202
Total questions: 136
Worksheet time: 1hrs 8mins
In the context of a DBMS, what is meant by "data integrity"?
A. The ability to perform multiple queries simultaneously
B. Ensuring data is consistent, accurate, and reliable
C. The ability to recover data after a failure
D. Encrypting data to protect it from unauthorized access
A person or persons responsible for the structure or schema of the database is
A. A User
B. A Coder
C. A Customer
D. A database administrator
What data structure will be represented for the hierarchical data model?
A. Array structure
B. Table structure.
C. Tree structure
D. Pointers structure
In query compiler, which unit builds a tree structure from the text form of the query?
A. A query parser
B. A query preprocessor
C. A query optimizer
D. A query processor
If there is more than one key for relation schema in DBMS then each key relation schema is classified as
A. Prime key
B. Super key
C. Candidate key
D. Primary key
In a network data model, a child node can be linked to multiple parent nodes. What is this relationship called?
A. many-to-one
B. one-to-many
C. many-to-many
D. one-to-one
___________ returns a relation instance containing all tuples that occur in both R and S
A. Intersection
B. Set-difference
C. Union
D. Cross-product
The primary key is selected from the:
A. foreign keys.
B. candidate keys
C. determinants.
D. composite keys.
What is Database Normalization?
A. A process where by a limit is put on the number of fields a record can contain
B. The process of ensuring that each table has a key
C. The process of ensuring that a relational database has at least two tables in it
D. A process whereby the design of a table (relation) is decomposed into more tables that more precisely fit the relational mode
Consider a relation with schema R(A, B, C, D) and FD's (A-> B, B-> C, B-> D, D->A). Which of the following is the {A}+?
A (A)
B. (ABCD)
C. (ABC)
D. (AB)
Given following schema R(A, B, C, D) and S=(A-B, B-C, C-D) Compute (A)+?
A. AB
B. ABC
C. ABCD
D. BCD
In relational database design, which normal form of a relation eliminates multi-valued attributes and ensures that data is organized at a fundamental level?
A. 1NF
B. 2NF
C. 3NF
D. 4NF
Which normalization level ensures that there are no repeating groups in tables?
A. First Normal Form (1NF)
B Second Normal Form (2NF)
C. Third Normal Form (3NF)
D. Boyce-Codd Normal Form (BCNF)
Relationships in the E/R model are also represented by relations. The relation for a given relationship R has the following attributes: If the relationship has attributes, then these are also attributes of relation R.
A. True
B. False
Which type of relationship connects two entities where one entity can have multiple associations with another entity, but the second entity can only have one association with the first entity?
A. One-to-One
В. One-to-Many
C. Many-to-Many
D. Many-to-One
In an ERD, what does a line connecting two entities represent?
A. An attribute
B. A relationship
C. A primary key
D. A foreign key
What is a derived attribute in an ERD?
A. An attribute that is calculated from other attributes
B. An attribute that cannot be calculated
C. An attribute that is the primary key of an entity
D. An attribute that represents a relationship
In an ERD, what role does a primary key play?
A. It uniquely identifies each record in a table
B. It establishes relationships between tables
C. It determines the data type of attributes
D. It defines the cardinality of relationships
_________ Real-world thing, distinguishable from other objects, in ERD
A. Entity
B. Diagram
C. Relationship
D. Primary entity
In relational database design, which of the following is known as a set of entities of the same type that share the same properties or attributes?
A. Entity Relation model
B. Entity set
C. Field set
D. Record set
To convert from ER Diagram to Relational Model, 1-M relationship
A. Put key attribute of one-side to M-side
B. Put key attribute of M-side to one-side
C. Generate 1 relation, Primary key of this relation combined from two relations
D. Build a table with two columns, one column for each participating entity set's primary key.
In the relational model, how are relationships represented between tables
A. By adding attributes to each table
B. By creating a new table for each relationship
C. By adding foreign keys to related tables
D. By creating a primary key in each table
A. Unknown, unknown, false
B. True, false, unknown
C. True, unknown, unknown
D. Unknown, false, unknown
Which of the following is correct?
A. SELECT datepart(DATE, '10-jan-24')
B. SELECT datepart('10-jan-24', DATE
B. SELECT datepart('10-jan-24', DATE
D. SELECT datepart(DAY, 10-Jan-24')
Regarding difference between a primary key vs. unique key, which of the following is false?
A. There can be only one unique key for a table
B. A primary key is a key that uniquely identifies each record in a table but cannot store NULL values
C. A unique key prevents duplicate values in a column and can store NULL values.
D. Only one primary key is allowed to use in a table.
You have a table named Books that has columns named Book Title and Description. There is a full-text index on these columns. You need to return rows from the table in which the word 'computer' exists in either column. Which code segment should you use?
A. SELECT FROM Books WHERE FREETEXT(", 'computer')
B. SELECT FROM Books WHERE Book Title LIKE '%computer%'
C. SELECT FROM Books WHERE Book Title = '%computer%' OR Description = "%computer%'
D. SELECT FROM Books WHERE FREETEXT (Book Title, 'computer')
Given the table Student(Studld, StudName), table Subject(Subld, SubName) and test score table (Studld, SubName, MarkExam). Suppose we need to query: "Find students who have never taken the Arithmetic exam", Which of the following operations can we use in SQL statements?
A. not in
B. not exists
C. not in or not exists
D. not in and not exists at the same time
E. None of the mentioned answers
UPDATE
-------------- instructor salary salary 1.05,
Fill in with correct keyword to update the instructor relation.
A. Where
B. Set
C. In
D. Select
Your database contains a table named Purchases. The table includes a DATETIME column named Purchase Time that stores the date and time each purchase is made. There is a non-clustered index on the Purchase Time column. The business team wants a report that displays the total number of purchases made on the current day. You need to write a query that will return the correct results in the most efficient manner. Which Transact-SQL query should you use
A SELECT COUNT(*) FROM Purchases WHERE PurchaseTime = CONVERT(DATE, GETDATE())
B. SELECT COUNT(*) FROM Purchases WHERE PurchaseTime = GETDATE()
C. SELECT COUNT(*) FROM Purchases WHERE CONVERT(VARCHAR, Purchase Time, 112) = CONVERT(VARCHAR, GETDATE(), 112)
D. SELECT COUNT(*) FROM Purchases WHERE Purchase Time >= CONVERT(DATE, GETDATE()) AND PurchaseTime < DATEADD(DAY, 1, CONVERT(DATE, GETDATE()))
In an UPDATE statement, what does the WHERE clause determine?
A. The order of update
B. The columns to be updated
C. The condition for selecting rows to be updated
D. The table to be updated
Let ParamountMovies be the VIEW defined from the Movies table: CREATE VIEW ParamountMovies AS SELECT title, year FROM Movies WHERE studioName = 'Paramount If you execute the statement: DROP VIEW ParamountMovies choose the correct statement for the Movies table.
A. Dropping the VIEW does not affect any tuples in the Movies table.
B. Dropping the VIEW affects some tuples in the Movies table that belong to the VIEW ParamountMovies
C. Dropping the VIEW ParamountMovies that was created from the Movies table, so we can no longer query the Movies table
D. The Movies table will be drop out the database.
What is the most useful index we can put on a relation?
A. Index on a unique attribute
B. Index not on the key
C. Index on its key
D. Index on a numeric attribute
What is a database trigger in SQL Server?
A. A stored procedure that runs automatically in response to certain events on a table or view
B. A scheduled job that runs at specific times
C. A function that can be called by other stored procedures
D. A query that retrieves data from the database
Foreign key constraints are created by using the" ________"keyword to refer to the primary key of another table.
A. Refer
B. References
C. Referential
D. All of the others
The transaction methods is used with the Connection object to save or cancel changes made to the data source.
A. Begin Transaction, Rollback Transaction
B. Begin Transaction, Commit Transaction
C. Begin Transaction, Commit Transaction, Rollback Transaction
D. Commit Transaction, Rollback Transaction
Transaction processing is associated with everything below except.
A. Producing detail, summery, or exception reports
B. Recording a business activity
C. Confirming an action or triggering a response
D. Maintaining data
Two concurrent executing transactions T1 and T2 are allowed to update the same record in an uncontrolled manner. In such a scenario. The following problem may not occur if database system has no concurrency module and allows concurrent execution of above two transactions. Which of the following is correct in this case?
A. Transaction failure
B. Dirty read problem
C. Lost update problem
D. Inconsistent database state
What is an SQL virtual table that is constructed from other tables?
A. Just another table
B. A view
C. A relation
C. A relation
Which one of the following is not true for a view?
A View never contains derived columns.
B. A view definition is permanently stored as part of the database
B. A view definition is permanently stored as part of the database
C. View is a virtual table,
Create a stored procedure named GetEmployeeByID that accepts an EmployeeID as a parameter and returns the corresponding employee's details
A. CREATE PROCEDURE GetEmployeeByID @EmployeeID INT AS BEGIN SELECT FROM Employees WHERE EmployeeID = @EmployeelD; END:
B. CREATE PROCEDURE GetEmployeeByID Declare @EmployeeID INT AS BEGIN SELECT FROM Employees WHERE EmployeeID = @EmployeeID: END
C. CREATE PROCEDURE GetEmployeeByID @EmployeeID INT AS BEGIN SELECT FROM Employees; END
C. CREATE PROCEDURE GetEmployeeByID @EmployeeID INT AS BEGIN SELECT FROM Employees; END
Which of the commands below undoes the current transaction?
A SAVEPOINT
B. ALTER
C. ROLLBACK
D. COMMIT
Which command is used to remove a relation from an SQL?
A. Drop table
B Delete
C. Purge
D. Remove
How can you invoke a user-defined function in a SQL query?
A. Using the EXECUTE statement
B. Using the CALL statement
C. Using the SELECT statement
D. Using the RUN statement
Which of the following describes an SQL cursor?
A. It allows you to traverse the result set of a query and process each row individually
B. is a precompiled collection of one or more SQL statements that can be executed as a single unit
C. A field within a database
D. Cursors are not related to SQL
Which of the following is not a typical trigger action?
A. Insert
B. Select
C. Update
D. Delete
Which of the following is true about stored procedure in MS-SQL Server?
A. They include procedural and SQL statements
B. They are stored in Rules folder
C. They do not need to have a unique name
D. They are same as void function
We can use these --------- in SQL queries and other statements to perform compu-tations that cannot be done with SQL alone.
A. Trigger
B. View
C. Index
D. Stored-procedure
Which key does not accept the null value?
A. Unique Key
B. Primary Key
C. Foreign Key
D. Candidate key
What is a weak entity in an ERD?
A. An entity with no attributes
B. An entity that participates in a one-to-many relationship
C. An entity that cannot exist without being related to another entity
D. An entity with a composite key
In query compiler, which unit transforms the initial query plan into the best available sequence of operations on the actual data?
A. A query parser
B. A query preprocessor
C. A query optimizer
D. A query processor
Which of the following is not a feature of DBMS?
A. Minimum duplication of data
B. Redundancy of data
C. Single-user access only
D. Support ACID Property
What data structure will be represented for the hierarchical data model?
A. Array structure
B. Table structure
C. Tree structure
D. Pointers structure
What is a database?
A. Organized collection of information that cannot be accessed, updated, and managed
B. Collection of data or information without organizing
C. Organized collection of data or information that can be accessed, updated, and managed
D. Organized collection of data that cannot be updated
In query compiler, which unit builds a tree structure from the text form of the query?
A. A query parser
B. A query preprocessor
C. A query optimizer
D. A query processor
What is a database?
A. A collection of information that exists over a long period of time. A collection of related data and managed by a database management system.
B. The database is built based on the relational data model.
C. Database used to create, update and exploit relational databases.
D. The database is built based on the relational data model and exploits the relational database.
Which of the following is the appropriate characteristic of a database?
A. Because a database is created to suit the format of the data, it cannot respond flexibly to data format changes.
B. The procedure for making backups is complicated.
C. It is difficult to share data between operations due to an exclusive control function.
D. It can be accessed by multiple users at the same time due to an exclusive control function.
Database data models usually have a way to go describe limitations on what the data can be, is called
A. Constraints on the data
B. Operations on the data
C. Structure of the data
D. definition of data
In the relational DBMS, what is the difference between PRIMARY KEY and UNIQUE KEY?
A. UNIQUE KEY dosen't accept the NULL value but PRIMARY KEY does
B. UNIQUE KEY and PRIMARY KEY are the same
C. A table can have more than one PRIMARY KEY constraint but only one UNIQUE KEY
D. A table can have more than one UNIQUE KEY constraint but only one PRIMARY KEY
For the following relations and a Set operation: Employee Name | City | Gender Nguyen Trung Truc | HCM | Male Le Hong Son | HCM | Male Customer Name | City | Gender Nguyen Trung Truc | HCM | Male Tran Tuyet Nhi | HN | Female and Employee Customer What is the result of the difference operation?
A. Name | City | Gender Le Hong Son | HCM | Male
B. Name | City | Gender Nguyen Trung Truc | HCM | Male Tran Tuyet Nhi | HN | Female
C. Name | City | Gender Nguyen Trung Truc | HCM | Male Le Hong Son | HCM | Male
D. Name | City | Gender Nguyen Trung Truc | HCM | Male Le Hong Son | HCM | Male Tran HN | Female
What is relational algebra?
A. Relational algebra is a set of operations on relations.
B. Relational algebra is the decomposition of relations.
C. Relational algebra is eliminated from relations.
D. Relational algebra is gone from relations.
What is the full form of DBMS?
A. Data of Binary Management System
B. Database Management System
C. Database Management Service
D. Data Backup Management System
What is information?
A. A collection of unprocessed data
B. A collection of processed data
C. A collection of processed information
D. A collection of unprocessed information
The ability to query data, as well as insert, delete, and alter tuples, is offered by.
A. TCL (Transaction Control Language)
B. DCL (Data Control Language)
C. DDL (Data Definition Language)
D. DML (Data Manipulation Language)
What are the disadvantages of network data model?
A. Not support the high-level query language
B. Not support the relationships between nodes
C. Not support the database management system
D. Not support the storage method of very large amounts of data
What does an RDBMS consist of?
A. Collection of Tables
B. Collection of Records
C. Collection of Keys
D. Collection of Fields
What does an RDBMS consist of?
A. Collection of Tables
B. Collection of Records
C. Collection of Keys
D. Collection of Fields
Select the most correct answer
A. An index is not a data structure used to speed access to tuples of a relation, given values of one or more attributes.
B. The key to index cannot be any attribute or set of attributes, and need not be the key to the relation.
C. We can think of the index as a binary search tree of (key, locations) pairs in which a key a is not associated with a set of locations of the tulips.
D. An index is a data structure used to speed access to tuples of a relation, given values of one or more attributes.
In the relational model of data, what is the result of an algebraic query language?
A. Data series
B. Data file
C. Relation
D. database
For the following relations and a Set operation: Employee Name | City | Gender Nguyen Trung Truc | HCM | Male Le Hong Son | HCM | Male Customer Name | City | Gender Nguyen Trung Truc | HCM | Male Tran Tuyet Nhi | HN | Female and Employee Customer What is the result of the Union operation?
A. Name | City | Gender Nguyen Trung Truc | HCM | Male Le Hong Son | HCM | Male
B. Name | City | Gender Nguyen Trung Truc | HCM | Male Tran Tuyet Nhi | HN | Female
C. Name | City | Gender Nguyen Trung Truc | HCM | Male Le Hong Son | HCM | Male Nguyen Trung Truc | HCM | Male Tran Tuyet Nhi | HN | Female
DN FUD Gender Nguyen fruc HCM | Male | Male
The result which operation contains all pairs of tuples from the two relations, regardless of whether their attribute values match.
A. Join
B. Cartesian product
C. Intersection
D. Set difference
To modify the schema of an existing relation use_______
A. Create table
B. Modify table
C. Alter table
D. Drop table
Which operation is commonly used to display all the properties derived from the original property?
A. Union
B. Intersection
C. Closure
D. Projection
If a relation is in BCNF, then it is also in
A. 1 NF
B. 2 NF
C. 3 NF
D. All of the mentioned
Which of the following statements is true about data normalization:
A. INF is a relationship with a primary key and no repeating groups
B. 2NF is 1NF without transitive functional dependencies
C. 3NF is 1NF without partial functional dependencies
D. All of the above answers are wrong
Which of the following statements is true regarding Third Normal Form (3NF)?
A. It eliminates transitive dependencies
B. It allows for redundant data
C. It only considers partial dependencies
D. It doesn't address any anomalies in a database
Suppose that we have a relation: R(ID, full name, address) and FDs (ID->full name, ID->address) What is the highest normal form of R in relational database design? Choose correct answers?
A. 2NF
B. 1NF
C. 3NF
D. BCNF
Which of the following statements about relational databases is true?
A. The database is built on a relational data model.
B. The database is created from excel software.
C. Relational databases are only relations with attributes that are not primary keys.
D. Relational database is the relationship between rows and columns in a data table.
Which of the following statements is correct when converting from the ERD model to the relational model?
A. The order of the columns is not important
B. The order of both rows and columns is important
C. The order of the rows is important
D. The order of the columns is important
In the entity-relationship model, what is the entity?
A. Relationships
B. Relationships between objects
C. Objects and relationships between objects
D. Data objects
How are weak entity sets represented in an Entity Relationship Diagram (ERD)?
A. With rectangle
B. With diamond shape
C. With a double-line rectangle
D. With a dashed oval
What does the attribute domain define in the relational model?
A. The primary key of the table
B. The foreign key references.
C. The cardinality of relationships
D. The data type and range of values that an attribute can hold
Which statement is used to remove a column named E into the relation R?
A. ALTER TABLE R DROP COLUMN E [DataType]
B. ALTER TABLE R DROP COLUMN E
C. ALTER TABLE R DELETE COLUMN E
D. ALTER TABLE R DELETE COLUMN E [DataType]
Which of the following is NOT the binary operation in the relational Algebra?
A. Project
B. Cartesian product
C. Union
D. Set difference
Which of the following is NOT a standard aggregation operator?
A. Sum
B. Max
C. Count
D. Group
A Delete command operates on _________ relation.
A. One
B. Two
C. Several
D. Null
In order to undo the work of transaction after last commit which one should be used?
A. View
B. Commit
C. Rollback
D. Flashback
Which of the following SQL statement remove all of the content from a table name "employees" but keep the schema?
A. DELETE FROM employees;
B. TRUNCATE FROM employees;
C. DROP TABLE employees;
D. REMOVE FROM employees;
Foreign key is the one in which the___________ of one relation is referenced in another relation.
A. Foreign key
B. Primary key
C. References
D. Check constraint
In which objects can Transaction be used?
A. View, User-defined function
B. User-defined function, Store Procedure
C. Store Procedure, Trigger, View
D. User-defined function, Store Procedure, Trigger
E. All of the mentioned answers are wrong
What happens if an error occurs during a transaction and it is not explicitly handled or rolled back?
A. The transaction is automatically committed
B. The transaction is automatically rolled back
C. The database becomes read-only
D. The transaction remains in a pending state
Which of the following is not mentioned how does a local variable is defined using T-SQL?
A. The name of the local variable should begin with "@@" sign as the first character of its name.
B. A local variable is defined using T-SQL by using statement "DECLARE".
C. When a variable is first declared, its value is set to NULL. To assign a value to a variable, use the SET statement.
D. The data type of local variable is declared after its name and assigned a system-supplied or user-defined data type and a length.
What are the different events in Triggers?
A. Select, Insert
B. Select, Update
C. Select, Commit
D. Insert, Update, Delete
In SQL, what is the purpose of the CLOSE statement in relation to cursors?
A. To close the database connection
B. To close the cursor and release associated resources
C. To close the transaction
D. To close the result set
Which of the following methods fetch data from cursor to access data?
A. First, last, next, prior, absolute, relative
B. First, last, next
C. First, last, next, prior
D. First, absolute, relative
Which of the following is false about database trigger?
A. It automatically runs when an event occurs in the database server
B. DML triggers are frequently used for enforcing business rules and data integrity.
C. The same trigger action cannot be defined for more than one user action (for example, INSERT and UPDATE) in the same CREATE TRIGGER statement
D. When a trigger fires, results are returned to the calling application, just like with stored procedures.
Which of the following represents Armstrong's Axiom of Transitivity?
A. If A B, then AC BC
B. If A B and B C, then A C
C. If A B, then BA
D. If A B, then A BC
A database administrator: a person or persons responsible for the struc-ture or schema of the database.
A. True
B. False
According to the technology deployed by the database management system, which of the following is correct?
A Locks are used to maintain transactional integrity and consistency.
B. Cursors are used to maintain transactional integrity and consistency
C. Procedures are used to maintain transactional integrity and consistency
D. Functions are used to maintain transactional integrity and consistency.
Queries and other DML actions are grouped into________ which are units that must be executed atomically and in isolation from one another
A. Transactions
B. Query compiler
C. Data files
D. Buffer manager
Consider the two relations from our running movie database: Movies(title, year, length, genre, studioName, producerC#) MovieExec(name, address, cert#, netWorth) The producerC# component of each Movies tuple must also appear in the cert# component of some MovieExec tuple How can we express this integrity constraint in relational algebra?
A. n_(producerC#) (Movies)=n_(cert#) (MovieExec)
B. n (producerC#) (Movies)n_(cert#) (MovieExec)
C. n_(cert#) (MovieExec)n_(producerC#) (Movies)
D. n_(producerC#) (Movies)=n_(cert#) (MovieExec)
What is the foreign key?
A. It is a relational constraint that enforces referential integrity between two tables
B. It is a relational constraint that that ensures the values in a specific column or set of columns are unique across all the rows in a table
C. The key that need to make a data in another table
D A collection of data that allows to access and use of that data
The rows of a relation, other than the header row containing the attribute names, are called____
A. Schemas
B. Tuples
C. Domains
D. Attributes
The values appearing in given attributes of any tuple in the referencing relation must likewise occur in specified attributes of at least one tuple in the referenced relation, according to____ constraint integrity
A. Referential
B. Primary
C. Referencing
D. Specific
What are logical constraints?
A. The relationships between attributes are represented by relational operations.
B. The relationships between attributes are represented by comparisons operator.
C. The relationships between attributes are represented by mathematical expressions.
D. The relationships between attributes are represented by functional dependencies.
The relations are constructed by the SQL language processor when it performs its job of executing queries and data modifications, and then thrown away and not stored, are called____________
A. Stored relations
B. Temporary tables
C. Relationships
D. Procedures
____________is a set of one or more attributes taken collectively to uniquely identify a record.
A. Primary Key
B. Foreign key
C. Super key
D. Candidate key
A(n)_____ is a property of the entire relation, rather than of the individual tuples in which each tuple is unique.
A. Row
B. Key
C. Attribute
D. Field
Consider the relation: OrderDetail (orderNumber, productCode, productName, quantity, dateOrdered, sales Discount) And FDs{ orderNumber, productCode->quantity orderNumber->dateOrdered, productCode->productName, sales Discount) And the key of OrderDetail is (orderNumber, productCode} Which of the following is full dependency on the key?
A. orderNumber, productCode->quantity
B. orderNumber->dateOrdered
C. productCode->productName
D. productCode->productName, sales Discount
Problems such as redundancy that occur when we try to cram too much into a single relation are called_________
A. Normal Form
B. Anomalies
C. Decomposing Relations
D. None of the others
Given R as a relation, which of the following statements is correct about normalizing data in 3NF form:
A. If R: Has a primary key, no repeating groups, no multivalued attributes/composite attributes
B. If R. Has a primary key, no repeating groups, no multivalued attributes/complex attributes, no partial functional dependencies.
C. If R. Has a primary key, no repeating groups, no multivalued/composite attributes, no transitive dependencies.
D. If R. Has a primary key, no repeating groups, no multivalued attributes/complex attributes, no transitive functional dependencies, no partial functional dependencies.
E. If R. has complete functional dependency
What is the primary goal of normalization in database design?
A. To increase data redundancy
B. To simplify data retrieval
C. To introduce duplicate data
D. To violate functional dependencies
What are some benefits of normalization when converting an ERD to a relational model?
A Increased storage space efficiency
B. Reduced update anomalies
C. Simplified database queries
D. Enhanced data security
Given that Cartoons and Murder Mysteries are special Movie genres, what is the relationship between entities Cartoons, Murder Mysteries and Movie?
A. isa relationship
B. ais relationship
C. supporting relationship
D. referential integrity relationship
Let E1 and E2 be two entities in an E/R diagram with simple single-valued attributes. R1 and R2 are two relationships between E1 and E2, where R1 is one-to-many and R2 is many-to-many. R1 and R2 do not have any attributes of their own. What is the minimum number of tables required to represent this situation in the relational model?
A. 2
B. 3
C. 4
D. 5
How are composite attributes represented in the relational model?
A. As individual attributes in the related tables
B. By creating a new table for each composite attribute
C. By using a single attribute in the related tables
D. By using a composite key in the related tables
How are many-to-many relationships typically represented in the relational model?
A. By adding attributes to one of the related tables
B. By creating a new table with foreign keys from both related tables
C. By denormalizing the database
D. By creating a new table for each related entity
Which of the following wildcard characters matches any sequence of zero or more characters in a string comparison?
A. &
B. S
C. _
D. %
Which 2 of the following are not aggregate functions in SQL Server?
A. Sum, Count
B. Diff, Mult
C. Sum, Avg
D. Count, avg
E. Min, max
Identify the correct query for viewing only those records wherein the customers have a phone number?
A SELECT from customers where phone IS NOT NULL
B. SELECT from customers where phone = NOT NULL
C. SELECT from customers where phone NOT NULL
D. SELECT from customers where HAVING phone NOT NULL
Which SQL clause is used to add a new column to an existing table?
A. ADD COLUMN
B. ALTER TABLE ADD COLUMN
C. INSERT INTO
D. CREATE COLUMN
Which of the following is false about a foreign key?
A. Whereas only one foreign key is allowed in a table.
B. It refers to the field in a table which is the primary key of another table
C. It can contain duplicate values and a table in a relational database.
D. It can also contain NULL values.
Which SQL statement selects all rows from table called Contest, with column ContestDate having values greater or equal to May 25,2006?
A. SELECT FROM Contest WHERE ContestDate >= '05/25/2006'
B. SELECT FROM Contest GROUPBY ContestDate >= '05/25/2006'
C. SELECT FROM Contest WHERE ContestDate < '05/25/2006
D. SELECT FROM Contest HAVING ContestDate >= '05/25/2006
In MS-SQL Server, which of the following is true about join operator? SELECT FROM BICUSTOMER, tblORDER
A. Cartesian join
B. Equi-join
C. Natural join
D. Outer join
Suppose relation R 1(A, B) has the following tuples: AB 1 a 2 b 3 c 4 d 5 e and the relation R 2(C, A) has the following tuples CA 101 1 1022 103 3 104 1 105 1 Which tuple is contained in the result of the following query: SELECT R1 B, R2 C FROM R1 RIGHT JOIN R2 ON R1. A = R2A ;
A. (a, ,101), (a, 104); (a, 105); (b, 102); (c, 103); (d, NULL); (e, NULL)
B. (a,10 1); (b, 102) ;(c,103);(a,104);(a,105)
C. (a, 101) / (b, 102); (c, 103)
D. (a, 101); (a, 104); (b, 102); (c, 103); (e, NULL)
Which of the following is true about A UNION query?
A. Combines the output from multiple queries and must include the same number of columns and data types.
B. Combines the output from no more than two queries and must include the same number of columns and data types.
C. Combines the output from no more than two queries and does not include the same number of columns and data types.
D. Combines the output from multiple queries and does not include the same number of columns and data types
In SQL query, choose the correct statement about the order of execution.
SELECT-FROM-WHERE - GROUP BY-HAVING - ORDER BY A.
B. SELECT-FROM-GROUP BY-WHERE-HAVING-ORDER BY
C. SELECT-FROM-HAVING GROUP BY-WHERE-ORDER BY
D. SELECT-FROM-OREDER BY WHERE-HAVING-GROUP BY -
Which of the following statement removes dbsale and dbsupplier database by using data definition language (DDL)?
A. DROP DATABASE dbSale, dbsupplier
B. DROP DATABASE dbSale and dbsupplier
C. DROP DATABASE dbSale; dbsupplier
D. DROP DATABASE dbSale + dbsupplier
Which property of a transaction ensures that the execution of a transaction should not be interfered with by any other transactions executing concurrently?
A. Atomicity
B. Durability
C. Isolation
D. Consistency
What is the main disadvantage of having too many indexes on a table?
A. Improved query performance
B. Increased storage space
C. Enhanced data integrity
D. Fast data modification operations
Which is the SQL statement that creates an updatable view? In this question, all the tables in the SQL statements are updatable.
A. CREATE VIEW Ordered_Product (Product_No) AS SELECT DISTINCT Product_No FROM Order
B. CREATE VIEW Order_List(Order_No, Product_Name, Order_Quantity) AS SELECT Order_No, Product_Name, Order_Quantity FROM Order, Product WHERE Order Product_No=Product Product_No
C. CREATE VIEW Product_Order(Product_No, Order_Quantity) AS SELECT Product_No, SUM(Order_Quantity) FROM Order GROUP BY Product_No
D. CREATE VIEW Expensive Product(Product No, Product Name) AS SELECT Product No, Product_Name FROM Product WHERE Product_Unit_Price>1000
In SQL, to update a relation's schema, which one of the following statements can be used?
A. Insert
B. Update
C. Alter
D. Alter table
A__________is a stored program that is attached to a table or a view.
A. pseudofile
B. embedded SELECT statement
C. trigger
D. None of the mentioned is correct.
Which type of user-defined function in SQL returns a single value?
A Scalar function
B Table-valued function
C. Inline function
D. Aggregate function
What is NOT true about the cursor in SQL?
A. It is considered the best practice to use when we want insert, update, or delete data in a table of SQL Server.
B. The cursor allows users to process data from a result set, one row at a time.
C. Cursors are an alternative to commands, which operate on all rows in a result set at the same time.
D. Unlike commands, cursors can be used to update data on a row-by-row basis.
How many types of variables are there in Stored Procedure
A. Default variable and input variable
B. Default variable and output variable
C. Input variable and output variable
D. Local variables and global variables
The following SQL statement creates a stored procedure that count number of customers in each City from the "Customers" table: CREATE PROCEDURE CountOfCustomers @City nvarchar(30), @CountCus int OUTPUT AS SET @CountCus = ( SELECT COUNT(CustomerID) FROM Customers WHERE City = @City GROUP BY City ) GO, Which of the following is the way to execute a procedure?
A. DECLARE @CountCustomers int EXEC CountOfCustomers @City = 'Berlin', @CountCus= @CountCustomers;
B. DECLARE @CountCustomers int EXEC CountOfCustomers @City = 'Berlin', @CountCus= @CountCustomers OUTPUT:
C. EXECUTE CountOfCustomers 'Berlin', @CountCus= @CountCustomers OUTPUT,
D. DECLARE @CountCustomers int EXEC CountOfCustomers @CountCus= @CountCustomers OUTPUT:
