58
Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. 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 #2 Task #3 Draw the E-R diagram for your database

Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

Embed Size (px)

Citation preview

Page 1: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

Task #1Create a relational database on computers in computer classroom 308, using MySQL server and any client.

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 #2

Task #3Draw the E-R diagram for your database

Page 2: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

Create new database, choose a suitable name.

Page 3: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 4: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 5: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

Create at least three tables, then insert some testing data.

Page 6: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 7: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

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.

Page 8: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 9: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

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.

Page 10: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 11: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

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)

Page 12: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 13: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

Now, you can select items from both tables; query will return only connected data (rows) from the tables.

Page 14: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 15: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

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.

Page 16: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 17: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 18: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 19: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 20: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 21: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 22: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

Last example is the "Report Wizard".

Reports are used when printing data, or exporting to a pdf format.

Page 23: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 24: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

Skipped: data source selection (query with combination of users and cars, who them rented).

Next slide: Grouping options:

Page 25: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 26: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 27: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 28: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 29: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 30: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 31: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

… open the prepared report in the design view:

Page 32: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 33: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

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.

Page 34: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 35: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 36: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

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.

Page 37: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 38: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

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)

Page 39: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 40: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

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).

Page 41: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 42: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

One of possibilities is to set a Visual Basic procedure. For beginners, creating of an macro could be easier.

Page 43: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 44: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 45: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 46: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

... screens from defining a macro ...

"Control name" is the name of an object on the active Form. Active record is bind 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.

Page 47: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 48: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 49: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

... create a new button while design view of a form ...

Page 50: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 51: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

If the Visual Basic macro should be used, it has to be defined (written) before.

Page 52: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 53: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

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.

Page 54: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 55: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 56: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

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)

Page 57: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access
Page 58: Task #1 Create a relational database on computers in computer classroom 308, using MySQL server and any client. Create the same database, using MS Access

All for now.