Instructions: Use 12 Font-Size, Arial and Single Space. Bring Printed It and Send It To

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Homework No.

Name: José Rodríguez Date:05/14/2019


Group: 1EB221
Instructions: Use 12 font-size, Arial and single space. Bring printed it and send it to
the email of the yahoo group [email protected]
1. What is a query in database?
A query is a request for data or information from a database table or
combination of tables. This data may be generated as results returned by
Structured Query Language (SQL) or as pictorials, graphs or complex results,
e.g., trend analyses from data-mining tools.
One of several different query languages may be used to perform a range of
simple to complex database queries. SQL, the most well-known and widely-
used query language, is familiar to most database administrators (DBAs).

2. What is the structure of a query in database?

The basic structure of each query is similar: The first keyword (e.g.,
SELECT) tells the database which operation to carry out; the following
statements refine this statement into specific instructions. These include the
table(s) to adjust/query, the types/values of records to work on, or how to
group the data.

3. Bring 5 examples of database queries.


A. AND
SELECT column_name(s)
FROM table_name
WHERE column_1 = value_1
AND column_2 = value_2;
AND is an operator that combines two conditions. Both conditions must
be true for the row to be included in the result set.

B. BETWEEN
SELECT column_name(s)
FROM table_name
WHERE column_name BETWEEN value_1 AND value_2;
The BETWEEN operator is used to filter the result set within a certain
range. The values can be numbers, text or dates.

C. CASE
SELECT column_name,
HhCASE
WHEN condition THEN 'Result_1'
WHEN condition THEN 'Result_2'
ELSE 'Result_3'
END
FROM table_name;
CASE statements are used to create different outputs (usually in the
SELECT statement). It is SQL’s way of handling if-then logic.

D. COUNT()
SELECT COUNT(column_name)
FROM table_name;
COUNT() is a function that takes the name of a column as an argument
and counts the number of rows where the column is not NULL.

E. DELETE
DELETE FROM table_name
WHERE some_column = some_value;
DELETE statements are used to remove rows from a table.

You might also like