Tutorial 3
Tutorial 3
Tutorial 3
(b) Display a list of products, including the description and unit price.
SELECT description, unit_price
FROM product;
FROM customer;
(c) Create a query to display the product number, Product description, unit price and
unit price after a raise of 13% VAT. Name the last column (unit price after a
raise) heading as “Including VAT” (Product table).
SELECT prod_no, prod_desc, unit_price, unit_price + (0.13 * unit_price)
AS “Including VAT”
FROM products;
(d) Create a query to display the customer’s number and customer’s name in the
same field and name the column heading as “Customer Details” also place literal
Customer Details
SELECT 'The Customer number of' ||' '|| cust_name ||' is '|| cust_no
AS "Customer Details"
FROM customer;
Question 2
Explain the terms Data Definition Language, Data Manipulation Language and Data
Control Language. As part of your explanation you should provide knowledge of the
use of at least 3 commands for each language using SQL notation.
Date Definition Language: DDL is the abbreviation for Data Defining Language.
The set of SQL commands that are create and manipulate the structures of the
database are called data defining language. It is a language that is used for creating
and modifying structure of the database objects, such as tables, indexes, etc. DDL
helps to specify the logical design of each relation.
Data Modeling refers to the process of creating a data model for the data to be
stored in a database. This data model is a logical representation of data objects, the
associations between different data objects. Data modeling helps in the visual
representation of data and establishes rules and regulations on the data. Data
Models ensure consistency in naming conventions, default values, semantics, and
security while ensuring quality of the data. Data Model is an abstract of conceptual
design process.
The data model consists of three types which are listed below:
The logical and the physical database design consists entities, relationships,
primary keys and foreign key while the conceptual design consists of entities
and relationships between the entities.
The conceptual design doesn’t represent any attributes while the logical and
physical model represents attributes.
The conceptual design is the basis to develop the logical design while the
logical design is the basis to develop the physical design.
The conceptual design is simpler in terms of both logical and physical
database design.
Physical and logical design implements normalization while the conceptual
design does not.
(d) Describe:
Internal Schema: The internal schema is the lowest level of data abstraction. It
tells what data are stored in the database. It contains multiple types of records. It
helps you to keeps information about the actual representation of the entire
database. Like the actual storage of the data on the disk in the form of records.
Logical Schema: This schema defines all database entities, their attributes, and
their relationships. This level of the abstraction also deals with the security and
the integrity of the information. This logical level comes between the user level
and physical storage view.
External Schema: This is the level of abstraction in which the end-users interact
with the information. Each external view is defined using an external schema,
which consists of definitions of various types of external record of that specific
view. External schema level is nearest to the user.