SQL Fundamentals Quiz
48 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which SQL keyword is used to add rows to a database table?

  • JOIN
  • UPDATE
  • INSERT (correct)
  • CREATE

What is the purpose of the INTERSECT command in SQL?

  • Combine results from two queries with all unique rows.
  • Return only rows that appear in both result sets. (correct)
  • Remove rows from a table.
  • Join two tables based on a common column.

Which two columns should be selected to create a composite primary key for the ChapterLanguage table?

  • City
  • ChapterId (correct)
  • Country
  • LanguageId (correct)

In order to normalize data to third normal form, how many tables should you create from a given recipe data?

<p>3 (D)</p> Signup and view all the answers

Which command should be used to retrieve data from two related database tables?

<p>JOIN (A)</p> Signup and view all the answers

Which keyword would you use to combine the results of two queries and return only the unique rows?

<p>UNION (C)</p> Signup and view all the answers

To evaluate changes in database objects, which SQL statements should you use?

<p>Data definition language (DDL) statements (D)</p> Signup and view all the answers

What is the primary function of the UPDATE command in SQL?

<p>To modify existing rows in a table (D)</p> Signup and view all the answers

What is the appropriate term to fill in the blank: The _______________ model for database management is based on first-order predicate logic?

<p>relational (C)</p> Signup and view all the answers

Which normal form should be applied to avoid many-to-many relationships in the StudentInformation table?

<p>3 NF (A)</p> Signup and view all the answers

Which of the following are steps in the database planning life cycle? Select three.

<p>Application Design (A), Conceptual database design (B), Operational Maintenance (D)</p> Signup and view all the answers

What are the characteristics of effective application design? Select three.

<p>Transaction data usability (A), Output of the transaction (C), Anticipated utilization rate (D)</p> Signup and view all the answers

Which design should John implement to create a description of a database on secondary storage media?

<p>Physical database design (A)</p> Signup and view all the answers

What would be the correct action to resolve a SELECT permission error on the CurrentEmp table?

<p>Grant permissions to the employee (C)</p> Signup and view all the answers

Which of the following is NOT a characteristic of relational databases?

<p>Inability to handle complex queries (B)</p> Signup and view all the answers

Which normal form helps to prevent redundancy in database design?

<p>3 NF (C)</p> Signup and view all the answers

Which management activity enhances the efficiency of database application stages?

<p>Requirements collection and analysis (D)</p> Signup and view all the answers

What action can resolve an issue with a failed DML statement on the Sales table? (Choose two.)

<p>Provide an appropriate privilege or create views on the Sales table. (A), Clean up all the uncommitted transactions on the Sales table. (B)</p> Signup and view all the answers

What is the process of extracting trails for transfer to a non-accessible security system by database administrators?

<p>Native auditing (D)</p> Signup and view all the answers

How can you reduce fragmentation caused by page splits in the OrderDetails table?

<p>Change the fillfactor for the indexes to 60. (D)</p> Signup and view all the answers

Which method effectively disables remote connections to a MySQL server?

<p>Start the server with the --skip-networking option. (C)</p> Signup and view all the answers

Which scenario correctly describes referential integrity?

<p>Enforcing relationships between tables through foreign keys. (B)</p> Signup and view all the answers

What happens when page splitting occurs in a heavily transacted table?

<p>Performance may degrade due to fragmentation. (C)</p> Signup and view all the answers

Which of the following actions can improve data retrieval performance in a database?

<p>Regularly updating index statistics. (C)</p> Signup and view all the answers

Which clause should be included in usp_GetEmp to ensure it executes under the context of the owner?

<p>With Execute As Owner (B)</p> Signup and view all the answers

What type of database design is used to create a high-level representation of the data structure?

<p>Conceptual database design (B)</p> Signup and view all the answers

Which of the following files should you copy for a backup related to MySQL replication?

<p>Master.info (D)</p> Signup and view all the answers

What is the best approach to prevent unauthorized changes to a SQL Server database?

<p>Database security (C)</p> Signup and view all the answers

Which two files contain essential configuration information that must be restored after a MySQL database server crash?

<p>My.cnf (A), My.ini (B)</p> Signup and view all the answers

Which SQL query correctly ensures that the lastname column in the employees table will not accept null values?

<p>CREATE TABLE employees (id INTEGER PRIMARY KEY, firstname CHAR(50) NULL, lastname CHAR(75) NOT NULL, dateofbirth DATE NULL); (B)</p> Signup and view all the answers

What type of database design involves how data is physically stored?

<p>Physical database design (B)</p> Signup and view all the answers

Which action is necessary to give an employee access to the CurrentEmp table?

<p>Grant the employee the SELECT permission on the CurrentEmp table (D)</p> Signup and view all the answers

What type of trigger should be implemented to ensure the ExamModifiedDate is updated only if no constraint violation occurs?

<p>INSTEAD OF trigger (B)</p> Signup and view all the answers

Which option will successfully create a trigger that updates ExamModifiedDate with the current date and time on the ExamQuestions table?

<p>CREATE TRIGGER trgExamQuestionsModified ON dbo.ExamQuestions INSTEAD OF UPDATE NOT FOR REPLICATION AS UPDATE Exams SET ExamModifiedDate = GetDate() FROM inserted WHERE inserted.ExamID = Exams.ExamID (B)</p> Signup and view all the answers

To restrict a MySQL server to only accept clients with new-format passwords, which option is correct?

<p>Start the server with the --secure-auth option (D)</p> Signup and view all the answers

Which command is NOT used to terminate a transaction?

<p>TRUNCATE (D)</p> Signup and view all the answers

What mechanism protects a database from unintended activities such as misuse and attacks?

<p>Database security (A)</p> Signup and view all the answers

Which command effectively rolls back the previous operations in a transaction?

<p>ROLLBACK (C)</p> Signup and view all the answers

Which of the following triggers would activate upon an UPDATE action on exam entries?

<p>AFTER UPDATE trigger (A)</p> Signup and view all the answers

Which command would you use to finalize a successful transaction in MySQL?

<p>COMMIT (D)</p> Signup and view all the answers

Which query will retrieve ItemName and Price when chocolate appears in the ItemDescription column?

<p>SELECT ItemName, Price FROM products WHERE ItemDescription LIKE '%chocolate%'; (A)</p> Signup and view all the answers

What could likely cause a stored procedure to return all null values when verifying that there is data in the Person table?

<p>All columns being concatenated contain null values, including Prefix. (A)</p> Signup and view all the answers

Which SQL statement will return the country and number of orders in each country where the number of orders is less than 50?

<p>SELECT Country, COUNT(orderID) AS Orders FROM orders GROUP BY Country HAVING COUNT(orderID) &lt; 50; (D)</p> Signup and view all the answers

Which feature does a relational database use to ensure that data entered into a column is valid?

<p>Data Types (C)</p> Signup and view all the answers

Which condition is likely to prevent a table from being in third normal form?

<p>A column is dependent on a non-key attribute. (D)</p> Signup and view all the answers

Which of these statements about functions and stored procedures is correct?

<p>Functions may be used within a SQL statement, whereas procedures cannot. (C)</p> Signup and view all the answers

Which query will return a result set of orders placed after January 2023 in all states except California?

<p>SELECT * FROM orders WHERE orderDate &gt; '2023-01-01' AND State != 'CA'; (B)</p> Signup and view all the answers

What is the correct way to create a report of data from the students table based on specific requirements?

<p>SELECT enrollment_date, graduation_date, academic_status FROM students WHERE academic_status = 'Graduated'; (C)</p> Signup and view all the answers

Flashcards

Data Definition Language (DDL)

A set of commands used to define and modify the structure of a database, including creating, altering, and deleting tables and other database objects.

Data Manipulation Language (DML)

Commands used to manipulate data within a database, including adding, deleting, and updating rows.

JOIN

A SQL command used to combine rows from two or more tables based on a related column.

INSERT

A SQL command used to add new rows of data into a table.

Signup and view all the flashcards

INTERSECT

A SQL command that returns rows that exist in both result sets of two queries.

Signup and view all the flashcards

Third Normal Form (3NF)

A database normalization standard where all columns depend on the primary key and no column depends on any other non-key column.

Signup and view all the flashcards

Composite Primary Key

A primary key consisting of two or more columns that uniquely identifies a record in a table.

Signup and view all the flashcards

Relational Database

A database that stores data in tables, with related data linked through shared columns.

Signup and view all the flashcards

Relational Model

A database model based on first-order predicate logic, using tables with rows and columns to represent data.

Signup and view all the flashcards

Many-to-Many Relationships (Database)

When two or more tables have multiple corresponding entries in another table. Like a student taking multiple courses, and courses with many students.

Signup and view all the flashcards

Database Planning Life Cycle

The complete process of creating and managing a database, including design, development, implementation, and maintenance.

Signup and view all the flashcards

Application Design Characteristics

The key elements that define the functionality and behavior of a database application, focusing on user needs and interaction.

Signup and view all the flashcards

Logical Database Design

Defines the structure and organization of data within a database, focusing on entities, relationships, and attributes. Describes what data is stored, but not where or how.

Signup and view all the flashcards

Physical Database Design

Describes how data is physically stored and accessed on storage devices, including file structures, indexes, and data access methods.

Signup and view all the flashcards

Stored Procedure Permissions

Database security rules that control which users can access and modify specific objects, such as tables, views, or stored procedures.

Signup and view all the flashcards

Database Error: 'The SELECT permission was denied...'

This error occurs when a user lacks the necessary permissions to view data from a specific table.

Signup and view all the flashcards

Database Planning

A management activity that ensures database application stages are completed efficiently and effectively. It guides the design, development, and implementation of the database, considering goals and resources.

Signup and view all the flashcards

Object Identification

The process of identifying and defining the various objects in a database system. These objects can include tables, views, stored procedures, and other database components.

Signup and view all the flashcards

Referential Integrity

A database constraint that enforces relationships between tables. It ensures that data in related tables is consistent and accurate. For example, a customer table and an order table must have matching customer IDs.

Signup and view all the flashcards

Native Auditing

A database security feature that records user activities and system events, capturing details like SQL statements executed, data accessed, and changes made. It allows for monitoring and investigation.

Signup and view all the flashcards

Fill Factor

A database index parameter that determines the percentage of space to be filled in each index page. A lower fill factor leaves more space for future inserts, reducing fragmentation but potentially increasing index size.

Signup and view all the flashcards

Page Splitting

A database process where an index page becomes full and needs to be divided into two pages. This can happen due to frequent inserts, leading to index fragmentation.

Signup and view all the flashcards

DML (Data Manipulation Language)

A subset of SQL that allows users to modify data in a database. It includes statements like INSERT, UPDATE, and DELETE for adding, changing, and removing data.

Signup and view all the flashcards

Transaction

A logical unit of work in a database. It consists of a series of operations that must be completed together or none at all, ensuring data consistency.

Signup and view all the flashcards

What is a Physical Database Design?

A detailed blueprint of how data is physically stored and accessed in a database, including file structures, indexes, and storage allocation.

Signup and view all the flashcards

What is a Conceptual Database Design?

A high-level representation of the data structure and relationships in a database, focusing on the entities and their attributes, without considering physical implementation details.

Signup and view all the flashcards

What is a Logical Database Design?

A detailed representation of the data structure and relationships in a database, focusing on tables, columns, and relationships, without considering the physical implementation.

Signup and view all the flashcards

What is the purpose of a database security measure?

To safeguard a database from unauthorized access, misuse, or accidental corruption, ensuring data integrity and confidentiality.

Signup and view all the flashcards

How does 'With Execute As Owner' work?

Executes a stored procedure or function with the permissions of the database owner instead of the user who called it.

Signup and view all the flashcards

How does 'With Execute As Caller' work?

Executes a stored procedure or function with the permissions of the user who called it.

Signup and view all the flashcards

What is the 'relay-log.info' file for?

Contains information about the replication process between a MySQL master server and its slave server(s), enabling the slave to stay synchronized with the master.

Signup and view all the flashcards

What kind of data does the 'my.ini' file hold?

Configuration settings for the MySQL database server, such as port number, data directory, and other system-wide parameters.

Signup and view all the flashcards

INSTEAD OF Trigger

A trigger that replaces the default SQL action for a specific data modification event (INSERT, UPDATE, DELETE) on a table.

Signup and view all the flashcards

AFTER Trigger

A trigger that executes after a specific data modification event (INSERT, UPDATE, DELETE) has been completed on a table.

Signup and view all the flashcards

FOR REPLICATION

A trigger option used for replicating data changes across databases; it ensures the trigger is executed only in the source database.

Signup and view all the flashcards

NOT FOR REPLICATION

A trigger option used to prevent the trigger from firing when data changes are being replicated across databases.

Signup and view all the flashcards

New-format Passwords in MySQL

MySQL versions 4.1 and above use a new, more secure password format that requires a separate authentication plugin.

Signup and view all the flashcards

Terminate a Transaction

Ending a transaction in a database, committing changes permanently or discarding them.

Signup and view all the flashcards

TRUNCATE

A SQL command used to remove all rows from a table without logging changes; it does not affect the table's structure.

Signup and view all the flashcards

Database Security

A comprehensive approach to protecting database systems and their data from unauthorized access, misuse, or accidental loss or corruption.

Signup and view all the flashcards

Query for Orders After January 2023

Retrieve orders placed after January 2023 in all states except California (CA).

Signup and view all the flashcards

Stored Procedure Null Values

A stored procedure returns all null values when data exists in the Person table. What's the likely culprit?

Signup and view all the flashcards

Retrieve ItemName and Price

Find ItemName and Price from a products table when "chocolate" appears in ItemDescription.

Signup and view all the flashcards

Function vs Stored Procedure

What distinguishes a function from a stored procedure?

Signup and view all the flashcards

Clustered Index

Describe the characteristics of a table with a clustered index.

Signup and view all the flashcards

Third Normal Form Violation

Identify the column in a table that prevents it from being in third normal form.

Signup and view all the flashcards

Country Order Count

Return the country and the number of orders in each country where the number of orders is less than 50.

Signup and view all the flashcards

Foreign Key Constraint

What feature ensures the validity of data entered into a column?

Signup and view all the flashcards

Study Notes

  • Database management systems (DBMS) use structures like bitmaps, b-trees, and hashes for data storage and retrieval.
  • Indexes are used to speed up data retrieval, particularly for SELECT statements, by reducing the amount of data that needs to be searched.
  • Normalization reduces data redundancy and improves data integrity by organizing data into separate tables.
  • A primary key uniquely identifies a row in a table.
  • A composite key is a combination of multiple columns that uniquely identifies a row in a table.
  • Stored procedures are sets of SQL statements that perform a specific task.
  • Stored procedures can improve performance and security.
  • GRANT SELECT gives user permission to read data in a table.
  • Database backups are crucial for data recovery.
  • Data types handle different kinds of data and are crucial for managing data storage space and ensuring data integrity.
  • Data is stored in rows and columns in tables.
  • A row in a table is called a tuple or a record.
  • A column in a table is called an attribute or a field.
  • Data manipulation language (DML) commands manipulate data within a database (e.g., INSERT, UPDATE, DELETE, SELECT)
  • Indexes can improve query performance.
  • Appropriate data types should be used for columns to minimize storage space.
  • Data integrity in relational databases is maintained by primary and foreign keys which link tables.
  • Data manipulation language (DML) commands may include INSERT, UPDATE, and DELETE to change data in a table.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

Description

Test your knowledge on SQL fundamentals with this quiz. Explore concepts such as commands, normalization, and database planning. Perfect for beginner to intermediate learners in database management.

More Like This

SQL Commands Quiz
3 questions

SQL Commands Quiz

EminentCelebration avatar
EminentCelebration
SQL Database Management
279 questions

SQL Database Management

CongenialCopernicium avatar
CongenialCopernicium
Use Quizgecko on...
Browser
Browser