0% found this document useful (0 votes)
56 views2 pages

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

José Rodríguez submitted homework assignment 2 on database queries which included examples of different types of queries. The homework defined a query as a request for data or information from a database and noted that SQL is a commonly used query language. It then provided the basic structure of a query and 5 examples - AND, BETWEEN, CASE, COUNT(), and DELETE - demonstrating how to select, filter, count, and delete data in a database.

Uploaded by

jose
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views2 pages

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

José Rodríguez submitted homework assignment 2 on database queries which included examples of different types of queries. The homework defined a query as a request for data or information from a database and noted that SQL is a commonly used query language. It then provided the basic structure of a query and 5 examples - AND, BETWEEN, CASE, COUNT(), and DELETE - demonstrating how to select, filter, count, and delete data in a database.

Uploaded by

jose
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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 TICEB221@yahoogroups.com
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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy