Uploaded by nazerke.sembay11

Лабораторная работа 1

advertisement
Lab work 1
Subject Area Analysis (University database, individual work)
Goal: to perform a first step of database design - Subject Area Analysis.
Task: to make a description of a future database according to the following plan.
Topic of the database for all students is an educational process at the university.
Note: the database should contain minimum 7 entities (tables).
Plan:
1. Specify stored information in the future database in the following way: "The
database is designed to hold information relating to/ about ...".
Databases can contain completely different information about the educational
process. Moreover, even in one university there can be several databases storing
different information. For this reason, the answer "The database will store information
about the university" will not work, so list in detail what information will be stored in
your future database. For example, personal information about students, teachers,
courses, etc.
2. List entities and attributes (in other words, tables and columns of the future
database).
As you know from the Lecture 1, you work with relational databases. In
relational databases, all information is stored in tables. List all tables in the required
format. Every entity should have an unique attribute - Primary key, underline it in the
description. Note: the database should contain minimum 7 entities (tables).
Examples.
Table1: Students (stud_id, last_name, first_name, date_of_birth, phone_number)
Table2: Groups (group_id, name, email)
3. List and describe all relationships between entities.
Important elements of relational databases are not only tables, but also
relationships between tables. Using relationships, we can get information from one
table using information from another table.
In the example above, the Students table stores only students' personal
information, and the Groups table stores information about study groups. For
example, to find out the name of a group by the last name of a student, or vice versa,
by the name of a group - a list of the last names of its students, you need to make a
relationship between the tables Students and Groups. Relationships should not exist
between all tables in the database, but only between those where it makes sense.
To describe a relationship between two entities (tables) answer 2 questions.
First of them is how one row from the first table refers to one or several rows from the
second table, and the second question (from the other side) is how one row from the
second table refers to one or several rows from the first table.
Example.
Relationship 1: Students – Groups:
One student (in other words, one row from Students) can be enrolled only in one
group (in other words, one row from Groups), and from the other side one group
(one row from Groups) contains many students (or N students) (many rows from
Students).
4. List all constraints (3-5 will be enough).
The database is a reflection of the real world, therefore, all restrictions that exist
at the university should be reflected in the database for convenient work. However,
constraints should only apply to the information that is stored in the database,
otherwise they cannot be implemented. The Students table stores the date of birth, so
we can write the constraint as in the example below.
Example.
Student’s date of birth must be later than 1980.
5. Specify all groups of users and their access rights (2 will be enough).
Database is used by different groups of users, and they have different access
rights. A group of users is all users who have the same access rights. Specify access
rights at the table level - access can be read-only or read-write, in other words, write
which tables these users will be able to edit, and which - only view (see example).
Note: do not specify the database administrator - it exists by default.
Example.
User group 1: Students. Access rights: table Schedule (read-only).
6. List all potential queries from users (10-15 will be enough).
Users will be able to get information from the database by writing a query. In
other words, a query is a question to the database to display certain information.
Example.
Show last names of students by the name of a group (show all students from the
SIS-1801).
Show information about all groups.
Upload: *.doc(x) or *.pdf
Materials:
• Lecture 1;
• Connolly, Thomas M. Database Systems: A Practical Approach to Design,
Implementation, and Management.
Download