LAB1 - An Islamic Banking Application Using C# & SQL Server
LAB1 - An Islamic Banking Application Using C# & SQL Server
0
Second Term Fourth Year lab 2012/2013
Learning Objectives
Upon completion of this lab, you will be able to:
Create database on SQL server 2005
Create tables and Views
Create relationship between tables
Write SQL quarries and run it
Define SQL service.
Define Database file (mdf and ldf files)
1
Second Term Fourth Year lab 2012/2013
In 1970s, the relational database model which originated in the academic research community
became available in commercial implementations such as IBM DB2 and Oracle. The relational data
model specifies data stored in relations that have some relationships among them (hence the name
relational).
In relational databases such as Sybase, Oracle, IBM DB2, MS SQL Server and MS Access, data is
stored in tables made up of one or more columns (Access calls a column a field). The data stored in
each column must be of a single data type such as Character, Number or Date. A collection of values
from each column of a table is called a record or a row in the table.
Different tables can have the same column in common. This feature is used to explicitly specify a
relationship between two tables. Values appearing in column A in one table are shared with another
table.
Step 2: From Objet Explorer window Right click on Database then select New Database
2
Second Term Fourth Year lab 2012/2013
Step 3: From New Database window enter database name as IslamicBank then click OK
3
Second Term Fourth Year lab 2012/2013
Customer Table
Accounts Table
Step 2: Define customer table fields as shown in the following figure then save it as Customer
4
Second Term Fourth Year lab 2012/2013
Exercise: Create the Accounts table in the same way we create Customer table as shown in the following
figure.
5
Second Term Fourth Year lab 2012/2013
Objective: Create view on the two tables contains the following columns
Step 1: Under IslamicBank database right click on Views then select New View. Then from Add Table
window select Customer and Accounts tables then click Add
Step 2: From view window select required columns then save this view as CustomerAccounts
6
Second Term Fourth Year lab 2012/2013
Note That:-
1- The relation between the two tables is donning using CustomerID field.
2- SQL statement for this view is:
7
Second Term Fourth Year lab 2012/2013