SQL Commands For Final
SQL Commands For Final
SQL Commands For Final
PHASE 2:
Phase 2: Database Initial Study In this phase, teams will focus on the design aspect of the project with an emphasis on
applying key principles and concepts such as data modelling, Entity-relationship (ER) modelling and normalization.
You are required to create designs that meet the requirements of Future Builders Credit Union.
6. Logical Design – CROW’s FOOT MODEL (10marks) Should reflect the following:
i. Entities: Objects/tables
ii. Attributes: characteristics/fields
iii. Keys: Primary/Foreign
iv. Business rules v. Connectivity: Relationship classification/type vi. Cardinalities (where applicable) vii. Relationship
Participation (optional/mandatory) viii. Associative/Composite/bridge entities (where applicable) ix. Strong & Weak
relationships x. Multivalued attributes using CHEN NOTATION (if applicable)
(Guide)
2. SQL STATEMENTS (25 marks) Use SQL statements which include instances of the following commands and options
a. Create Table
b. Altar Table
c. Insert
d. Select (using Where, Group by, Having and Order by)
e. Update
f. Comparison operators (at least THREE)
g. Logical operators (at least TWO) h. Special Operators (at least THREE)
i. Aggregate functions (at least TWO)
Conceptual Design
Conceptual ERD models the business objects that should exist in a system and the relationships
between them. A conceptual model is developed to present an overall picture of the system by
recognizing the business objects involved. It defines what entities exist, NOT which tables. For
example, One to many' tables may exist in a logical or physical data model but they are just shown
as a relationship with no cardinality under the conceptual data model.
Logical Design
The logical model is equipped with Entities, Constraints, Relationships, Primary Keys and Foreign
Keys and Columns
Entity-Relationship model
PHASE 3:
3.1 Create the database using MS ACCESS
3.2 Enter sample test data and perform various queries on the database using SQL
Create Table :
);
--------------------------------------------------------------------------------------------------------------------------
Altar Table :
--------------------------------------------------------------------------------------------------------------------------
CREATE TABLE Customer(
cust_id int NOT NULL,
customer_name varchar NOT NULL,
customer_address varchar NOT NULL,
customer_email varchar NOT NULL,
password varchar NOT NULL,
loan_ID int NOT NULL,
--------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------
INSERT INTO Accounts(account_id int, balance float, iban int, loan_id int, cust_id int)
VALUES
(30923, 500000, 5648, 123412341414, 102334221),
(30920, 3000000, 5648, 235252345233, 102334456),
(30921, 1000000, 5648, 112234234455, 101233349),
(30922, 60000, 5648, 134636363666, 104334451)
(30923, 300000, 5648, 123235632567, 104443321);
--------------------------------------------------------------------------------------------------------------------------
SELECT account_id
FROM Accounts
WHERE condition
GROUP BY balance
ORDER BY cust_id;
SELECT Loan(loan_id), loan_type
FROM Loan
GROUP BY loan_type
References
https://www.visual-paradigm.com/guide/data-modeling/what-is-entity-relationship-
diagram/#erd-data-models-physical
https://www.w3schools.com/sql/