Assignment:7

Assignment : 7

Databases


Practice Questions


Q.1 :Consider the following entities and their relationships Company (c_no, c_name, c_city, c_share_value) Person (p_no, p_name, p_city, p_ph_no) Relationship between Company and Person is many-to-many with descriptive attribute no_of_shares. Using the above database, write a PHP script to display person wise share details in tabular format.


Q.2 :Consider the following entities and their relationships Customer (c_no, c_name, c_city, c_ph_no ) Ticket (t_no, booking_date, fare, traveling_date) The relationship between Customer and Ticket is one-to-many. Create a RDB in 3 NF for the above. Using the above database, write a PHP script to accept date and display, 1) The total fare collected from customers on a given date. 2) Ticket details booked by the customer.



Set A


Q.1 :Write a PHP script to create an employee table using attributes employee number, employee name, address joining date and salary. If a table is created then display the appropriate message otherwise end the PHP script


Q.2 :Write a PHP script to accept account details (account number, account type and balance). Store these details in the account table and display an appropriate message.


Q.3 :Write a PHP script to accept product number from the user. Update the price of the product and display an appropriate message.


Set B


Q.1 :Consider the following entities and their relationships. Employee (eno, ename, sal) Project (pno, pname,duration) Employee and Project are related with a many-many relationship. Create a RDB in 3 NF for the above. Using the above database write a PHP script to accept the project name. Display the name ofthe employees and the duration of the project.


Q.2 :Consider the following entities and their relationships. Train(t_no, t_name) Passenger (p_no, p_name, addr, age) The relationship between Train and Passenger is many-to-many with descriptive attribute date, seat_no and amt. Create a RDB in 3 NF for the above. Using the above database write a PHP script to accept a date. Display train details having maximum passenger for a given date.


Q.3 :Consider the following entities and their relationships. Crop (c_no, c_name, c_season, pesticides) Farmer (f_no, f_name, f_location) The relationship between Crop and Farmer is many-to-many with descriptive attribute year. Create a RDB in 3 NF for the above. Using the above database write a PHP script to accept crop name and year value. Display total number of farmers harvesting given crop in a given year.


Set C


Q.1 :Consider the following entities and their relationships. Client (c_no, c_name, c_addr, birth_date) Policy_info (p_no, p_name, maturity_amt, prem_amt, policy_term) The relationship between Client and Policy_info is many-to-many with descriptive attribute date_of_purchase. Create a RDB in 3NF for the above. Using the above database write a PHP script to display policy details of a given client for a given year in the following format.