Professional Documents
Culture Documents
Desc Publisher
Organizes Assists
Book_ID Conducts
Books
Has Tours
Store_ID
P_ID
Billed
Has Bookstore Tours of
for
Lecture
P_Name
Super Entity Weak Entity
Place
Magazine Frequency P_type Desc
Lno
IS A
Price Location
L_SSno
Duration
Publisher
Mid Desc Historical Building Battlefield
Author
2. Designing Set of Relations
Customer
CustomerSSno CName CFname CLname DOB Address Contact#
Employee
EmpSSno Designation EName EFname ELname Contact# DOB Address DOJ Salary
Guide Lecturer
Lecture
Books
Book_ID Description Author Publisher Price
Magazine
Mid Description Author Publisher Price Frequency
Services
Recordno S_Type Service_ID Description CustomerSSno EmpSSno
Workshop
W_No Description Date
Courses
C_No C_Description C_Startdate Fee
Tours
T_ID T_Name T_Description P_ID Rates Seasons
Place
Data Dictionary
After creation select the database and open the New query Window. (LeBlanc, n.d.)
Create Table
Places
P_ID
P_Name
P_Type
Location
Services
Customer Recordno
Tours
CustomerSSno T_ID
S_Type
C_Name T_Name
Service_ID
DOB T_Desc
Description
Address P_ID
CustomerSSno
Contact# Rates
EmpSSno
Seasons
Workshop
W_No
Description
Date
Magazine Books
Mid Book_ID
Description Description
Author Author
Publisher Publisher
Price Price
Frequency
Insert query
Tables Along with data screenshot
Select Query
Table Aliases
Join
Inner Join between two tables on the basis of common column between the two tables.
Figure 28 Join
Union
Fetching unique values of addresses from the Employees and Customer table.
Figure 29 Union
Sub Query
5. Optimizing Database
Indexing: An index is created on a table to search data quickly and efficiently. Though
users are not able to see the indexes, but it is important in speeding up the search
queries being made on the table. (Anon., n.d.)
A table in general can have 1 clustered index and up to 999 non-Clustered Index. By
default when we create a table with Primary key that becomes the clustered index.
Select the Table expand the attributes of the table and expand the Indexes option.
There we can see there is already 1 Clustered Index.
We can also use Unique Index that will prevent duplicate values.
Defragment indexes
Figure 34 Fragmentation
Rebuild
6. Security
In SQL server different users can be created and assigned different roles. The different
types of roles are mentioned below:
Db_owner: can access, modify, and delete the records.DB_owner can also modify the
table structure.
sa- default admin of the database. It can carry any operations on the database.
(db_owner)
User2-can insert, update the records but cannot change the table structure.
(db_datawriter)
User2 Login
For the user2 logged in we are unable to perform the select and the Alter command as
the user has been assigned the role of db_writer. Thus the user can only insert the
records.
Login
For user 3 we are only able to read the records but insert and alter commands cannot
be executed as it has been assigned role of db_datareader
Figure 47 Sa Queries
Creating Views
For creating different views expand the Views folder right click and create new View
We can change the permissions and give extra privileges by selecting the user and
right click properties
Then click on the user mappings and we can change as per the roles desired.
Figure 51 Grant & revoke Privileges
7. Web Interface
Visual Studio 2013 has been used for developing the front User interface. (Microsoft,
n.d.)
User Interface
SqlDataSource is being used to perform the update and Delete options .Searching and
insertion of records is done by SQL DataAdapter and SQL Command.
Insert Records
For Inserting the records we need form to take inputs from the users .Clicking on the
new button will open the form. Enter all the details and click on the Submit button.
Code Required
Select the Search option and enter any value and click on the submit button.
Figure 65 Search Option
Bibliography
Anon., n.d. aa964133(v=sql.90). [Online]
Available at: https://technet.microsoft.com/en-us/library/aa964133(v=sql.90).aspx
[Accessed 20 Oct 2016].
Ramez Elmasri, S. B., 2011. Fundamentals of database System. sixth ed. s.l.:Addison-Wesley.