Download Task #1

Document related concepts

Open Database Connectivity wikipedia , lookup

Database wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

PL/SQL wikipedia , lookup

Ingres (database) wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Functional Database Model wikipedia , lookup

SQL wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Clusterpoint wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
Task #1
Create a relational database on computers in computer
classroom 308, using MySQL server and any client.
Task #2
Create the same database, using MS Access 2013.
• Three tables, which can be logically connected
• Queries for typical selection and combined listing of it
• Forms for entering new data, modifying data (to do the
database functions, depending on application)
• Example of report with use of grouping
Task #3
Draw the E-R diagram for your database
Create new database, choose a
suitable name.
Create at least three tables, then
insert some testing data.
Define type of each of fields.
General text should be the Varchar2
type.
Many other properties can be set.
Use help if you are not sure.
Column description can be set; it is
used, when a form is created.
Query can be used for selecting only
some of rows by use filtering, or when
working with data, presented in more
tables, if they are logically connected.
Queries is typically used as sources of
data for forms.
Connect tables by drag-and-drop a field
from one table to the respective field in
the other table.
Connection line will be added to the
scheme. Can be selected by mouse
and erased by the "Delete" key on
keyboard, or by local menu (use right
mouse button)
Now, you can select items from both
tables; query will return only connected
data (rows) from the tables.
Form can be created using the
Create ribbon. You can select
"Form design" to create form in the
design view. In the next example,
the "Form Wizard" is used.
Prepared form can be easily
adapted (or adjusted), if needed,
by "Open in design view" from the
list of objects.
Last example is the "Report
Wizard".
Reports are used when printing
data, or exporting to a pdf format.
Skipped: data source selection
(query with combination of users
and cars, who them rented).
Next slide: Grouping options:
… open the prepared report in the design
view:
Query can be opened in the same
style, as table.
You can even add new data to original
table. If the query doesn't contain some of
fields, the default value will be set. If no
default value has been defined while
designing the table, null will be used.
If the null value is not acceptable, an error
will be reported.
The next features, as use of the Visual
Basic, is not obligatory, but will be
counted as some extra points.
On the next slide, only cars, for where no
client is defined, will be listed.
Result = list of available cars.
Lists only cars, where the user id is bigger
then zero – zero means “no user”:
(for use this convention, the link to user
table cannot be fixed as table relation
[primary to public key], because of there
is no user with id of zero; alternatively
specific user, for example with id=1, can
be created)
To modify a query, you can use its SQL
definition.
On the next slides, first create new query,
then select table as a data source:
To add all data, click the first line of the
list of fields, with the star ( * ) symbol.
double click
To show the query in the SQL form, click
to the “View” icon on the Design ribbon.
To create the main menu, create a new
Form in the design view, place buttons
and by the right mouse button, look for
their properties.
For assigning a function, the "On Click"
event should be filled. The possibility of
"Open Form..." is the most often. Another
easy to create is a closing of the
application (a Quit button).
One of possibilities is to set a Visual Basic
procedure. For beginners, creating of an
macro could be easier.
... screens from defining a macro ...
"Control name" is the name of an object
on the active Form. Active record is bound
with the line in the table, by using
"SaveRecord" can be written back to the
table. Before this, values can be changed
by the macro.
On the end, the active Form is closed.
↘ Macro in version 2010 is on the ribbon „Create“:
... create a new button while design view
of a form ...
If the Visual Basic macro should be used,
it has to be defined (written) before.
For setting a link value to another table,
you can select the value from a combo
box. Combo box should be prefilled with a
corresponding data.
On the next slide, common situation (just
link to a query data) is shown. On the
second slide, combo box for an another
table link is prefilled with an SQL
command.
Text of this request is:
SELECT Zákazník.ID_zakaznika,
Zákazník.Příjmení, Zákazník.Jméno FROM
Zákazník;
Resulting behavior after executing:
(the SELECT command returns three
columns)
All for now.