You are on page 1of 10

11 Databases, II

Consultations
¿What is a consultation?
es la hoja que se obtiene después de seleccionar los registros
It is the sheet that is obtained after selecting the records that meet
certain conditions, always imposed by the user.
Differences between queries(CONSULTATIONS)
consultas
and filters:
With filters, you can only use fields from the same table.
With queries you can combine fields from multiple tables.
Purpose of the consultations:
View, modify, or analyze data.
They are a source records source for forms, reports, etc.
1
11 Databases, II
TYPES OF QUERIES(CONSULTATIONS)
ELEMENT DEFINITION

SELECTION They allow you to display the data, analyze it and even edit it.
In addition, you can automatically combine fields from two or
more tables or queries and using the criteria you specify. The
results are displayed in the order you want. They are the
most common.
OF CROSS- They organize the information according to different grouping
REFERENCE values. They calculate the sum, the average or other types of
TABLES totals by grouping some data from different parts

ACTION They are used to make changes to a particular group of


selected records using the specified parameters. Queries of
this class can be deleted, updated, table creation, and
appended data (which add existing records in another to a
table).
2
11 Databases, II
TYPES OF QUERIES(CONSULTATIONS)

TYPE DEFINITION

UNION
They combine fields from one or more tables into one.

DUPLICATE SEARCH
They determine whether duplicate records exist in a table
or which ones share the same value.

SEARCH FOR They help locate records in one table that don't have
MISMATCHES related records in another.
PARAMETERS They offer the possibility for the user to specify the
search criteria at the time of executing them.
OF TOTALS They are based on the use of aggregate functions (sum,
account, max, etc.).

3
11 Databases, II
SOME CRITERIA USED IN CONSULTATIONS
FIELD EXPRESSION DESCRIPTION

Customer "Jaén“ Shows the customers of Jaén.


Customer "Madrid" O "Sevilla" Show customers from Madrid or Seville.

Shipping date Between #9-Jan- Presents shipments made no earlier than


2012# AND #15-Jan- 9-01-2012 or after 15-01-2012.
2012 #
Shipping Denied "USA." View shipments to countries other than
country the U.S.
Clients As "S*"
Displays clients whose name begins with S.

Company name >="N" Companies whose name begins with the


letters N to Z appear.
4
Shipping Region Not Null Displays orders from customers whose
Shipping Region field contains a value.
11 Databases, II

Forms formularios

What is a form?
herramienta
It is the tool used to enter, modify and present the information
stored in one or more tables of a database.
Parts of a form:
Headline. The identification data of the form are provided.

Body. Exposes all relevant information.

Foot. It includes indicative elements, such as page number, date.

5
11 Databases, II

Options for creating forms

• Split forms. They are standard forms.


• Form wizard. Allows the creation of subforms.
• Forms in Design View. The user creates the form
without the help of the wizard, allowing for more
asistente para formularios
creativity.
• Advanced forms. They incorporate controls.

6
11 Databases, II

Reports informes

¿What is a report?
Reports obtain the information from the fields in the tables in the
database and organize and summarize it consistently. They are
ideal for working when hard copies are needed. In addition, if the
data in the tables is modified, the reports will be updated
automatically.

Ways to create a report:


Using the Report Wizard.
In Design view.
Self-reports: simple reports.

7
11 Databases, II

The SQL Language

What is SQL?
It is a structured query language that allows you to perform
various tasks of management and control of databases, in
addition to performing searches and queries.
An SQL statement is a set of words written in English that
indicates what you want to get and where to look for it. It
always starts with a verb and is followed by various clauses,
mandatory or not.
Some statements: SELECT, ALL, DISTINCT, FROM, WHERE,
ORDER BY, DESC, GROUP BY.

8
11 Databases, II

The SQL Language

Names used in SQL: NO ENTRA

• Simple name. Consists only of the column name.


• Qualified name. It consists of the name of the table, a
period, and the name of the column.
• If the name has blank spaces, it is written in square brackets.
• Alias. The second name that is assigned to the table or
column and with which it will be displayed at the end of the
task.

You might also like