IT CertificationsComprehensive Study Set

Comptia Sql

104 questions across 0 topics. Use the find bar or section chips to jump to what you need.

Community-sourced. Answers may be wrong or out of date. Always verify with your official training portal before submitting. Not affiliated with any branch, agency, or vendor. Details.
QUESTION 1

Which would be the LEAST desirable architecture option for a database that requires a high degree of scalability?

ANSWER

One-tier

QUESTION 2

Why is a query an important tool in database processing?

ANSWER

A query allows a user to extract only the data needed from a database by selecting specific rows and columns from a table.

QUESTION 3

In a relational database, data is organized into tables that are made up of rows and columns. The term "record" is a synonym for which of these terms?

ANSWER

Row The rows in a relational database are also called records. The term "record" has a logical meaning: each patient has a record. It is also a term that was originally used for a row in a flat file, and the term continued to be used after the advent of database technology.

QUESTION 4

Table

ANSWER

A table contains rows of data, which are also called records. For example, in a table containing data about a classroom, there would be one row/record in the table for each student.

QUESTION 5

Field

ANSWER

A field is an individual piece of data in a record. For example, a patient's last name would be a field in the patient record in a hospital database.

QUESTION 6

Colum

ANSWER

A column can also be called a field

QUESTION 7

Which is the correct sequence in the process of database creation?

ANSWER

CREATE DATABASE CREATE TABLE INSERT INTO In the database creation process, the database must be created first. It's the all-around container for all of the tables and data.

QUESTION 8

Which is the BEST example of importing data to populate a database?

ANSWER

Data records that are already stored in a digital format can be loaded directly into a database. The database expects to receive data in a digital format. Importing data is the process of copying existing digital data that is already stored on another device and pasting it into the database.

QUESTION 9

Which of the following statements best describes data persistence?

ANSWER

Data in memory is lost once the processing is completed. Data in a database is stored persistently and securely so that it can be used again in the future.

QUESTION 10

Data Persistence

ANSWER

Persistent data is data that is stored permanently in a database. A copy of the data may be loaded into memory at processing time and lost when processing is complete, but the original data is safely stored in the database. All data stored in the database is persistent, whether or not it is accessed frequently.

QUESTION 11

Why would a flat file system not be the optimum choice for data storage for an online shopping cart application?

ANSWER

A flat file system doesn't support multiple concurrent users. A successful online shopping application would be highly likely to have hundreds or thousands of users hitting the database at any given time. A flat file system is not able to support multiple concurrent users. Rather, it only provides access to one user at a time.

QUESTION 12

Flat File System

ANSWER

The structure of a flat file system is simpler than a database structure, since it has only rows and columns—much like a basic spreadsheet. Flat file systems are still supported by most programming languages and continue to have many relevant uses, such as storing simple collections of data and exporting and importing data between systems.

QUESTION 13

Why is the level of data integrity greater in a database than in a flat file?

ANSWER

A database can enforce data types for each column in a table, and can validate data as it is entered into those columns.

QUESTION 14

Data Integrity

ANSWER

A database does enforce data types for each field/column in a table; therefore, it can validate that the correct type of data is being entered and stored in each field.

QUESTION 15

Which language is typically used by Relational Database Management Systems (RDBMS) to maintain data?

ANSWER

Structured Query Language (SQL)

QUESTION 16

SQL

ANSWER

Structured Query Language

QUESTION 17

RDBMS

ANSWER

Relational Database Management Systems A relational database is created and managed by an RDBMS. A database server is the computer on which an RDBMS is installed and running, as it is used to create and manage databases. A query/report builder may be a feature of an RDBMS—or it may be an additional application software package that can connect to a database managed by the RDBMS.

QUESTION 18

What are the steps in the process of creating a database?

ANSWER

Determine how the database will be used by clients, where it will be hosted, and what information it will store.

QUESTION 19

Which statement is NOT true regarding the relationship between a table and its components?

ANSWER

A table always has the same number of columns as it has rows.

QUESTION 20

Why do a report and a query work well together?

ANSWER

A query can be used to extract only the data based on specified criteria, while a report can format and summarize the data making it easier to read and interpret.

QUESTION 21

What is a database?

ANSWER

A database is a collection of related data organized in a structured manner for easier access.

QUESTION 22

What term is defined as the ability of a database to increase in size as more information is added to it without increasing costs at the same rate?

ANSWER

Scalability

QUESTION 23

Why might a table called "Products" in a relational database have twelve rows?

ANSWER

There are twelve products.

QUESTION 24

In which order are the rows typically stored in a relational table?

ANSWER

The order in which they were entered into the database Each time a row is inserted into the database, it is added to the end of the appropriate table. Consequently, rows are stored in the order in which they were loaded into the table.

QUESTION 25

When processing large numbers of transactions, how does processing speed compare between databases and flat file systems?

ANSWER

Database processing speeds are much faster than flat file speeds. A database is organized by relating data together, so its processing speed is much faster than it can be with a flat file. The data stored in a database always processes more quickly because only the parts of the data that are needed are loaded into memory.

QUESTION 26

Flat file processing speeds

ANSWER

Flat file processing speeds are slower than database processing because each entire row must be read into memory whether or not all of the fields in the row are needed.

QUESTION 27

How do Relational Database Management Systems (RDBMS) handle multiple users accessing the same database concurrently?

ANSWER

Multiple users can view the same record at the same time. If more than one user attempts to update the same record at the same time, the RDBMS locks that record so that only one user at a time can update.

QUESTION 28

Relational Database Management Systems (RDBMS)

ANSWER

Often, many users will be viewing the same record—a product in an online catalog, for example—at exactly the same time. But, as soon as a user begins the order process, that record is locked from access by other users. The RDBMS will actually provide a message to let the second user know that the record is locked because someone else is in the middle of an update.

QUESTION 29

Microsoft SQL Server is an example of what?

ANSWER

RDBMS

QUESTION 30

SQL Server, Oracle, MS Access, and MySQL

ANSWER

all examples of Relational Database Management Systems (RDBMS).

QUESTION 31

A manager needs to view last month's sales figures. Which of the following functionalities can be done with a query statement?

ANSWER

Specifying criteria to match values in one or more fields

QUESTION 32

What is the relationship between queries and reports?

ANSWER

A query selects and retrieves the correct data, whereas a report formats and summarizes the output.

QUESTION 33

What type of flat file contains plain text with delimiters to set apart the columns?

ANSWER

Comma Separated Values (CSV)

QUESTION 34

How many students would be represented in a "Student" table containing 150 rows, 17 columns, 1 primary key, and 1 foreign key?

ANSWER

150

QUESTION 35

A database administrator is considering adding a primary key to enforce unique rows, defining a format for a phone number, and adding a rule so that a user must enter a date prior to today. What is the administrator adding to the database?

ANSWER

Constraints

QUESTION 36

Why might a language like Extensible Markup Language (XML) be commonly used in a document database?

ANSWER

XML makes it easier to parse and sort through the data in a variety of types of documents. Since Extensible Markup Language (XML) provides an easy way to identify individual pieces of data in different types of documents, it's a good choice for a document database where all the documents may be in different formats—spreadsheets, text files, Word files, etc. XML allows each document to be different and still have identifiable data inside.

QUESTION 37

XML vs HTML

ANSWER

XML and HTML are both markup languages, but have different purposes. HTML is for web page development. XML is for data storage.

QUESTION 38

You are designing a "Customer" table in a relational database. Which of the following fields would be the best candidate for a primary key?

ANSWER

CustomerNumber The primary key must be able to uniquely identify each customer from all other customers. In past decades, social security numbers were used for that purpose. Now, a good database designer would create a CustomerNumber field to use as the primary key and generate unique numbers for each customer.

QUESTION 39

How is a relational table structured?

ANSWER

A table is made up of rows and columns, where all of the rows include the same columns.

QUESTION 40

Relational Table

ANSWER

A table contains rows and columns of data, much like a spreadsheet. The columns are the same for all rows. For example, if a "Customer" table includes columns like customerID, lastName, and firstName, then each row in this table includes these columns. A relational table is very structured with specific fields/columns; consequently, fields are never randomly placed. All rows in a relational table include the same columns. There are no rows with a unique collection of columns. All columns in a relational table apply to the same rows. There are no columns with a unique collection of rows.

QUESTION 41

In a database where each employee is assigned to one project, and each project can have multiple employees, which database design option would apply?

ANSWER

The Project table has a primary key of ProjectID. The Employee table has a primary key of EmployeeID and a foreign key of ProjectID. Each of these tables needs a primary key, to uniquely identify each row with the corresponding ID field: ProjectID for the Project table and EmployeeID for the Employee table. Since each employee is assigned to only one project, the Employee table needs the ProjectID field as well, to identify which project each employee is assigned to. This field becomes the foreign key that relates with the Project table, and each ProjectID can appear in several records of the Employee table.

QUESTION 42

In a relational database table, what is the significance of creating a field with a varchar data type?

ANSWER

It allows a variable number of characters to be stored for a particular column in each row.

QUESTION 43

Varchar Data Type

ANSWER

The varchar data type provides for a variable-sized field type. If a book title is twenty-seven characters long, twenty-seven bytes are stored. If a title is only three characters long, only three bytes are stored, resulting in a significant savings in storage space. Varchar specifies a maximum number of bytes per column as a limit, but stores only the number of bytes used.

QUESTION 44

An attorney uses a standard form to capture information about new clients. Which type of database would best suit those needs?

ANSWER

A relational database

QUESTION 45

Which software package is a Relational Database Management System (RDBMS)?

ANSWER

Microsoft SQL Server

QUESTION 46

What is the purpose of a schema?

ANSWER

It describes the structure of a database.

QUESTION 47

How is a key/value pair database different from a relational database?

ANSWER

In a relational database, all attributes of a record are defined up front, and each record has all of the same attributes as the other records. In a key/value pair database, objects and their properties are stored, but each object doesn't have to have all of the properties.

QUESTION 48

Key/Value Pair Database

ANSWER

In a key/value pair database, objects and their properties are stored, but each object doesn't have to have all of the properties.

QUESTION 49

Relational Database

ANSWER

In a relational database, all attributes of a record are defined up front, and each record has all of the same attributes as the other records.

QUESTION 50

Which of the following statements is true about a column in a table of a relational database?

ANSWER

A column with naturally occurring unique values is a good choice to be the primary key. The column, or combination of columns, that becomes the primary key for the table, must be unique. If no such column exists naturally (i.e., social security number or employee id) then an automatically generated sequentially numbered column can be added to the table.

QUESTION 51

Columns

ANSWER

Columns can be in any order in a table. Some columns may be grouped together to make up a logical sequence (i.e., Last Name, Middle Initial, and First Name, or Address, City, State, and Zip Code), but even a random order of columns will work the same way. Each value for a given column has the same data type. The specifications of the table assign a data type to each column (i.e., string, number, date, etc.)

QUESTION 52

Why is it important to consider the number and size of columns included in a table schema?

ANSWER

The size of each row affects the amount of storage used, and how quickly it can be processed. Storage is important, but processing speed is often a critical factor in database applications. Rows must be kept as succinct as possible by carefully choosing field sizes, because each row is read into memory during processing.

QUESTION 53

A field in a relational table corresponds to which part of a spreadsheet?

ANSWER

A column

QUESTION 54

Your manager has asked you to display the customer database schema. What useful information will your schema provide?

ANSWER

The structure of the database

QUESTION 55

In a relational database, what is the relationship between a primary key and a foreign key?

ANSWER

The primary key is in one table and it is matched to the foreign key in a secondary table.

QUESTION 56

Structured databases work well, but why is it sometimes a better choice to store data in unstructured and semi-structured databases?

ANSWER

There are certain types of data (PowerPoint presentations, text files, Word documents, etc.) that are more easily stored without the rigid formatting a structured database requires.

QUESTION 57

Unstructured/Semi-Structured

ANSWER

It is more difficult to store documents and files in fields in a database table. Unstructured and semi-structured databases are made specifically to handle that kind of data.

QUESTION 58

Using a programmatic database access method to interact with a relational database would require what type of commands?

ANSWER

SQL

QUESTION 59

What is the purpose of the SQL DROP command?

ANSWER

To delete a table or an entire database It is a DDL command, which is very powerful in that it can delete an entire table or entire database, which includes all of the data as well

QUESTION 60

SQL DELETE command

ANSWER

Command used to delete one or more rows of data from an existing table

QUESTION 61

SQL ALTER command

ANSWER

An individual column can be deleted only by using the ALTER command

QUESTION 62

You've been tasled with changing the primary key in the Customer table from the CustID field to the AcctNum field. Which Data Definition Lnaguage (DDL) command can do that?

ANSWER

ALTER TABLE

QUESTION 63

DDL

ANSWER

Data Definition Language

QUESTION 64

ALTER TABLE

ANSWER

Command that can be used to add, remove, and change table columns, primary keys, and foreign keys

QUESTION 65

UPDATE

ANSWER

not a DDL command because it modifies data values inside a table, but doesn't modify the structure of a table

QUESTION 66

CREATE TABLE

ANSWER

Is a DDL command used to create a new table, and to establish a primary key at creation time. It cannot, however, be used to modify the primary key after it has been created.

QUESTION 67

INSERT

ANSWER

INSERT command only inserts data into an existing table and is not a DDL command

QUESTION 68

You submitted the following SQL command for a "Customer" table: DELETE FROM CUSTOMER. What happened next?

ANSWER

All of the records from the "Customer" table were deleted. Without a WHERE clause to specify which rows should be deleted, all of the rows would be deleted. Adding a clause lik e WHERE state = MN" would cause only the rows with Minnesota customers to be deleted.

QUESTION 69

Adding a new relational database, table, or index is a function of which Data Definition Language (DDL) command?

ANSWER

CREATE

QUESTION 70

CREATE

ANSWER

A new database, table, or index is added with the CREATE command

QUESTION 71

CREATE DATABASE

ANSWER

adds a new database

QUESTION 72

CREATE INDEX

ANSWER

adds an index to the tables, by specifying one or more columns which will be used for faster searching and sorting.

QUESTION 73

What is the purpose of the SQL INSERT command?

ANSWER

It adds a new row to a table in a database

QUESTION 74

What is the term used for the file that includes a copy of the database along with the schema?

ANSWER

Database dump

QUESTION 75

Database dump

ANSWER

Term used for a copy of the database or table schema along with the data records--all expressed as SQL CREATE and INSERT statements. The dump is used to create an exact duplicate of the database structure and load an exact copy of the data from the original database.

QUESTION 76

In a situation where a PC-based database and an application are both hosted on the same computer, what is the application architecture called?

ANSWER

One-tier

QUESTION 77

One-Tier Architecture

ANSWER

When the application, which includes reports, forms, queries, etc., is hosted on the same computer as the actual database, it's called a standalone or one-tier database application architecture

QUESTION 78

Two-Tier Architecture

ANSWER

Storing the database and the application on two separate servers makes for a two-tier architecture

QUESTION 79

N-Tier Architecture

ANSWER

Used to describe an even more complex structure where parts of the application may reside on different servers.

QUESTION 80

You've written an SQL query for an "Order" table: SELECT ProductName, Price from ProductMaster. Now your mentor asks you to add this line to your query: ORDER BY PRICE. How will that affect your query results?

ANSWER

The list of product names and prices will now be sorted by price.

QUESTION 81

ORDER BY

ANSWER

query that causes the query output to be sorted in ascending order.

QUESTION 82

Why might a database dump be a good option for backup/restore?

ANSWER

A database dump includes both the database data and the structure, so it could be restored whether the offending error was in the data or in the structure.

QUESTION 83

Database Corruption

ANSWER

A database can become corrupted in a variety of ways. A user can enter bad data that corrupts a table, a hacker can introduce a virus that changes permissions, or a program can have a bug that alters the wrong table. Either way, the error could be in the data or the structure, and both are covered by the database dump.

QUESTION 84

Why is the process of generating backups such an important feature of an RDBMS?

ANSWER

A database can contain mission-critical data, which an organization may not be able to afford to lose.

QUESTION 85

Which type of constraint is added to a table for the purpose of establishing a relationship with another table?

ANSWER

Foreign key A relationship between two tables requires a common column between the two tables. A foreign key is added to a table for the purpose of being that common column that matches back to a primary key in another table.

QUESTION 86

Primary Key

ANSWER

Added to a table for the purpose of making sure that each row in the table can be uniquely identified

QUESTION 87

Index

ANSWER

An index on the table is created for the purpose of making sorting and searching easier and faster.

QUESTION 88

Data Validation

ANSWER

A feature that helps users by reducing the possibility of errors during data entry.

QUESTION 89

Which of the following is the best example of a direct/manual database access method?

ANSWER

Log into phpMyAdmin and run SQL statements at the command prompt.

QUESTION 90

Which statement is NOT true regarding the SQL INSERT statement?

ANSWER

It is a data definition language statement.

QUESTION 91

In the event of an application failure, which application architecture model would be the most disruptive to users?

ANSWER

Standalone

QUESTION 92

What is the difference between the DELETE and DROP commands in SQL?

ANSWER

DELETE deletes rows from a table DROP eliminates the entire table

QUESTION 93

Why is a client-server application considered a two-tier architecture?

ANSWER

The database runs on a database server, while the application is run on the client computer.

QUESTION 94

Who would typically use a query/report builder to access database data?

ANSWER

Power users and programmers

QUESTION 95

Query and Report Builders

ANSWER

Query and report builders are typically used by those who need to interact closely with a database, but might not want to learn SQL commands. However, programmers also find them useful for quickly extracting data in some situations.

QUESTION 96

The use of a Graphical User Interface (GUI) to allow users to search and add records is an example of which type of database access method?

ANSWER

User interface/utility An ATM machine is an excellent example of a user interface that allows users to access a database. For example, withdrawing $100 from a savings account via an ATM updates the database to decrease your account balance by $100.

QUESTION 97

Which statement is NOT true regarding SQL permissions?

ANSWER

The owner of a table can assign only the permission to view (not update) data in the table to other users.

QUESTION 98

Which is the best way to issue SQL commands to manipulate data in a relational database?

ANSWER

It depends on the user's level of SQL experience, overall purpose, and access permissions.

QUESTION 99

You've been tasked with changing the primary key in the Customer table from the CustID field to the AcctNum field. Which Data Definition Language (DDL) command can do that?

ANSWER

ALTER TABLE

QUESTION 100

Queries often retrieve data from multiple tables. If the same column name is used in two tables, how does SQL know which column to use?

ANSWER

In the SELECT statement, the column name is prefixed by the table name.

QUESTION 101

You have been placed on a project to update the addresses of customers in a "Customer" table. Who can issue the SQL commands to give you permission to update the data in that table?

ANSWER

The owner of the "Customer" table

QUESTION 102

What is the SQL UPDATE command used for?

ANSWER

To change the value in one or more fields in a table The UPDATE command specifies one or more field values to be updated. If a WHERE clause is added, those fields are updated only for the rows that satisfy the selection criteria. For example, the command could be used to change the grade for one specific student from a B to a C if the studentID was specified in a WHERE clause.

QUESTION 103

What is a true statement about Data Definition Language (DDL)?

ANSWER

It comprises SQL commands that can add to or modify the structure of a database.

QUESTION 104

In a database application, what is the difference between a form and a report?

ANSWER

Both display data, but a form can be used to update the contents of the database as well.

Looking for a different version?

CBTs get updated every year. Search for the exact version you're taking (e.g. "cyber awareness 2025").

Search all study materials