Professional Documents
Culture Documents
Assignment no 2
) Semester: 4th Section: A,B, C Session:
Question 1: Consider the following Statement and Draw the Entity-Relationship model (ERD) by
showing all attributes, identifiers, relationships, Cardinalities and Modalities. Provide physical model to
elaborate Primary keys, Unique Keys and Foreign keys.
A local social services organization acts as an agent to help female clients in a variety of ways.
The organization stores information for each client which includes their social security number,
name, address, and phone number. In addition, because some of the services provided to clients
deals with the client’s dependents, information on dependents is also stored. This includes the
dependent’s social security number, name, and age. Clients are provided services that are in turn
provided by various service providers. For example, a client might be provided job training (a
service) that is provided by an agency in state government (the actual service provider). The
organization helps match clients with available services. It is not unusual for a single client to be
eligible for several services. Information about services includes a unique service identifier and a
description. When a client is provided with a service, the date that this happens also needs to be
recorded. Information on service providers includes a unique provider identifier, name, address,
and contact phone number. It is the policy of this organization to deal with as many service
providers as possible for a single service. For example, even though they use a state agency to
provide job training, they might also use a different private agency for job training.
Relational model:
ERD:
Question 2: Consider following Relational schema and write the DDL commands (Marks
16)
Create the necessary tables along with all attributes. Use appropriate Data types, add Primary key
constraints, make Primary Key Auto increment and add Foreign key constraints; (10 marks)
Add CHECK constraints on email of customer and make it an unique attribute (2 marks)
For Rental_Contract add current date and time as default date. (2 marks)
. Use Alter Command, Add Salary of employees and apply check to set range or salary from
35000 to 150000. (2 marks)
Code:
create database amna
use amna
go
create table c (
c_no int primary key identity(1,1),
c_name nvarchar (200),
c_model nvarchar (200) not null,
c_make int,
)
Good Luck