Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
CW_TEORSKII_ANATOLII.docx
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
165.08 Кб
Скачать

6. Queries

Create a query to our database, we gave out the information that we will need. Queries can be made directly to each entity from which we need information.

Question formed with respect to the database, and there is a request.

  1. Get information about the Autopark.

select * from Autopark;

  1. Get information about the number of buses and trolleybuses in the fleet.

select type as "Model", count(*) as "Quantity" from transport

group by type

order by count(*) desc;

c) Get information about buses that is ready for operation.

select * from transport

where Ready_for_use ='yes';

d) Get information about the driver who serve any transport.

select d.driver_name||','||d.driver_surname as "Full Name", d.Class_driving as "Class Driving", d.Exp as "driving experience", t.type as "Type of Transport"

from driver d, transport t, transpdrive trd

where t.transport_id=trd.transport_id and d.driver_id=trd.driver_id;

e) Search the Driver, whose telephone number begins at “8707” and ends with “48”

select Driver_name||' , '||Driver_surname as "Full Name",telephone_number as "Telephone Number" from driver

where telephone_number like '8707_____48';

f) Get information about the conductors who serve any transport.

select c.conductor_name||','||c.conductor_surname as "Full Name", t.type as "Type of Transport"

from conductor c, transport t, transpcond trc

where t.transport_id=trc.transport_id and c.conductor_id=trc.conductor_id;

g) Search the Driver, whose name ends at “ER”

select conductor_id as "ID", conductor_surname as "Surname" from conductor

where conductor_surname like '%er';

h) Get information about the validator is in any Trolleybus.

select v.validator_id as "ID",v.model_name as "Model name", v.Date_tech_inspec as "Date of Technical inspections", t.type as "Type of Transport"

from validator v, transport t

where v.transport_id=t.transport_id;

i) Get information about any transport routes.

select t.type as "Type of Transport", r.start_point as "Start Point", r.final_point as "Final Point", r.interval_length as "Interval Length"

from transport t, stoproute sr, route r

where t.transport_id=sr.transport_id and sr.route_id=r.route_id;

j) Search the Average salary.

select avg(salary) as "Average salary"

from driver;

CONCLUSION

I really liked the design databases, I'm going to seriously engage in the design of databases in the future.

During database creation, I learned a lot of new information and developed useful skills for themselves. Now I can create a lot of useful databases and help people.

Consider what we have done during operation

In the first stage, we decided on the theme and analyze the relevance of our future database. In the second stage we collect and analyze data on our database. Next, we create a ER-Diagram in Visio Studio, to understand our relationship to place and PK and FK. After that, we will transform our ER-Diagram in the table. In the table we denote the set of keys and data types for each element in each entity. Leads first to the first, second and third normal form. After that, start creating our entities in PostgreSQL. After we have created essentially by using the "CREATE TABLE", started with the command "INSERT" to fill our database of information that in the future we will call. Fill in essence strictly in the order in which we created these entities. First created and populated nature of which no one could depend on and then the other. After we filled the table, we have begun to request this information by using the "SELECT".

This database is not completely finished, it is only a small part of the functions which are carried out a database.

I am sure that my database is much help and facilitate the work in the Auto Park. I hope that in the future I will modify my database and I can fully realize its potential.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]