0% found this document useful (0 votes)
17 views8 pages

Basic SQL Test

The document consists of a series of questions related to SQL concepts, including definitions of SQL terms, functions, and commands. It covers topics such as the purpose of the AVG function, how to add columns to tables, and the use of clauses like HAVING and GROUP BY. Additionally, it addresses SQL operations like inserting, updating, and deleting records, as well as querying data from multiple tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views8 pages

Basic SQL Test

The document consists of a series of questions related to SQL concepts, including definitions of SQL terms, functions, and commands. It covers topics such as the purpose of the AVG function, how to add columns to tables, and the use of clauses like HAVING and GROUP BY. Additionally, it addresses SQL operations like inserting, updating, and deleting records, as well as querying data from multiple tables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Name: _______________________________________________________________________________________

What does the acronym SQL mean?

. Structured Query Language

. Structured Quiz Language

. Standard Question Language

. Structured Quorum Language

2. What is the purpose of the AVG function?

. Perform a full backup of the database

. Calculate the arithmetic mean of a set of data

. Run an antivirus on the database for security.

. Sort the data in a query in alphabetical order

3. Which of the following statements adds a column named ID_editora to an already existing table named
book_table?

. ALTER TABLE tbl_livro ADD ID_editora SMALLINT NOT NULL;

. CREATE TABLE tbl_book (ID_publisher SMALLINT NOT NULL);

. ALTER TABLE tbl_livro INSERT ID_editora SMALLINT NOT NULL;

. ALTER TABLE tbl_book ADD ID_publisher SMALLINT NOT NULL;

4. What is the function of the HAVING clause?

. We use the HAVING clause to join two tables in a query.


. We use the HAVING clause to specify filtering conditions on groups of records.

. We use the HAVING clause to replace the WHERE clause in queries.

. We use the HAVING clause to return records that start with a specific letter.

5. If we want to update a record in a database table, what statement should we use?

. MODIFY

. UPDATE

. UPGRADE

. TABLE-SET
6. How to return all the data from the tblClientes table for a user whose first name is 'Fábio' and whose last name is
"of the Kings", knowing that this information is located in the columns ClientName and ClientSurname,
respectively?

. SELECT ClientName, ClientSurname FROM ClientsTable WHERE ClientName='Fábio' AND


of the Kings

. SELECT * FROM tblCustomers WHERE FirstName='Fábio' AND LastName='dos Reis'

. SELECT ClientName, ClientSurname FROM tblClients WHERE ClientName="Fábio" OR


dos Reis

. SELECT "Fábio", "of Kings" FROM tblClientes

7. What declaration should we use to return the data from the column NomeCliente of the table
tblClients?

. SELECT ClientName FROM tblClients

. RETURN CustomerName FROM tblClients

. SELECT tblClients FROM ClientName

. GET ClientName BY tblClients

8. How to proceed to insert a new author with the last name 'Sagan' into a table named tblAutores?

. INSERT INTO tblAuthors (AuthorLastName) VALUES ('Sagan')

. INSERT INTO SobrenomeAutor.tblAutores VALUES ('Sagan')

. INSERT tblAuthors (AuthorLastName) VALUES ('Sagan')

. INSERT ('Sagan') INTO tblAuthors (AuthorLastName)

9.I need to obtain all the data from a table named tblProducts where the product names, that are
In the ProductName column, if they start with the letter M. How to proceed?
. SELECT $ FROM tblProducts WHERE ProductName LIKE 'M%'

. SELECT * FROM tblProducts WHERE ProductName = '%M'

. SELECT * FROM tblProducts WHERE ProductName LIKE 'M%'

. SELECT * FROM ProductName WHERE tblProducts = '%M'

10. We need to sort the results obtained in a SQL query. Which of the following
What statements should be used for this purpose?

. SORT BY

. ORDER

. CLASSIFY BY

. ORDER BY
11. To delete a single record from a table, which of the following statements can be used?

. TRUNCATE

. REMOVE

. ERASE

. DELETE

12. We need to schedule a database so that whenever a certain record is inserted into
A table, a specific action is to be performed automatically. What structure allows us to program this?

. VIEW

. STORED PROCEDURE

. TRIGGER

. CURSOR

13. Which of the following is NOT a type of join used in SQL?

. INNER JOIN

. OUTER JOIN

. EXTRA JOIN

. CROSS JOIN

14. What is the purpose of the GROUP BY clause?

. Group records according to the type of data declared in the table creation.

. Group data based on the result of a query that exclusively uses LEFT JOIN.
. Group records into subgroups based on columns or values returned by an expression

. Group data in queries performed through Stored Procedures triggered by a Trigger


Master

15. If you need to insert a new record into the database, which statement should you use?

. ADD REGISTER

. INSERT RECORD

. NEWDATA

. INSERT INTO
16. How to delete a view named vw_LivrosAutores?

. DELETE VIEW vw_BooksAuthors

. EXCLUDE VIEW vw_BooksAuthors

. DROP VIEW vw_BooksAuthors

. DROP VIEW vw_BooksAuthors

17. What statement should we use to return all the data of clients named Fábio from
table tblClients, where the name column is called NameClient?

. SELECT CustomerName FROM tblCustomers ORDER BY "Fabio"

. RETURN * FROM tblClients WITH NAME = "Fabio"

. SELECT * FROM tblClientes WHERE ClientName = 'Fabio'

. GET CustomerName FROM Customers WHERE CustomerName = "Fabio"

18.Which of the following groups contains only valid constraints in SQL?

. PRIMARY KEY

. PRIMARY KEY

. PRIMARY KEY

. FOREIGN KEY

19. What statement should we use to query a database?

. GET

. CONSULT
. SELECT

. QUERY

20. How to query two tables, of books and authors (tbl_book and tbl_authors), and return the relevant data
books and to the authors at the same time?

. SELECT * FROM tbl_Book INNER JOIN tbl_authors ON tbl_Book.Author_ID = tbl_authors.Author_ID

. SELECT * FROM tbl_Author INNER JOIN tbl_books ON tbl_Book.ID_Authors = tbl_author.ID_Author

. SELECT * FROM tbl_Book INNER JOIN tbl_authors ON tbl_Book = tbl_authors

. SELECT * FROM tbl_Book INNER JOIN tbl_author ON tbl_Book.Author_ID = tbl_authors.Author_ID

You might also like