Professional Documents
Culture Documents
GCD1102 Asm2
GCD1102 Asm2
GCD1102 Asm2
Unit number and title Unit 04: Database Design & Development
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand
that making a false declaration is a form of malpractice.
Student’s signature Km
Grading grid
P2 P3 P4 P5 M2 M3 M4 M5 D2 D3
Table of Tables
• The screen shows the result Add dish successfully, which means the dish information has been
successfully added to the database.
• Similar to the Add dish action, other actions will be performed similarly.
B. Output.
• Create Database: The Create Database statement is used to create a new SQL database. The Use command allows
specific databases to be used. Newly built database will be used here.
• Create Table: The Create Table statement is used to create a new table in the database. The column parameters
specify the names of the columns in the table. The data type parameter specifies the type of data the column can
hold (e.g., varchar, integer, date, etc.). To add to the table, you must use Replace, and you cannot delete those
constraints in the revision table.
• The diagram of the relationship between the tables for the SQL database built by SQL and queries is shown below:
o VARCHAR (Size): A variable length string (can contain letters, numbers, and special characters). The following
illustrates the syntax: VARCHAR(n). In this syntax, n defines the string length from 1 to 8,000. In this syntax,
the maximum storage size is 231-1 bytes (2 GB). In general, the storage size of a VARCHAR value is the actual
length of the data stored plus 2 bytes. (sqlservertutorial, SQL Server VARCHAR, 2022)
Data type Description Range Storage
Varchar A variable 8,000 2 bytes + number of
length string characters chars
o NVARCHAR: SQL Server NVARCHAR data type is used to store variable-length, Unicode string data. The
following shows the syntax of NVARCHAR(n). In this syntax, n defines the string length that ranges from 1 to
4,000. If you don’t specify the string length, its default value is 1. (sqlservertutorial, SQL Server NVARCHAR,
2022)
o DATE: To store the date data in the database, you use the SQL Server DATE data type. You use the SQL Server
DATE data type. the DATE data type has only the date component. The range of a DATE value is from January
1, 1 CE (0001-01-01) through December 31, 9999 CE (9999-12-31). It takes 3 bytes to store a DATE value.
(sqlservertutorial, SQL Server DATE, 2022)
In this format:
o YYYY is four digits that represent a year, which ranges from 0001 to 9999.
o MM is two digits that represent a month of a year, which ranges from 01 to 12.
o DD is two digits that represent a day of the specified month, which ranges from 01 to 31,
depending on the month.
• Identity.
In SQL Server, Identity column of a table is a column whose value increases automatically. The value in an identity
column is created by the server. A user generally cannot insert a value into an identity column. Identity column can
be used to uniquely identify the rows in the table.
• Get all the information about the Food in the name starting in "B":
II. Implement a query language into the relational database system. (P3)
2.1. Queries to SELECT data with illustrations of the final result.
After adding data to the tables, we can use the SELECT statement to verify the information:
• As an example, use the following query to select all tables in the system, including Customer, Bill, Order, and Food
and Chef.
Test Expected
Content Times
Case Result
1 Insert data into the tables 1 Pass
2 Update data in the tables 1 Pass
3 Delete data of the tables 1 Pass
4 Select data into the table 1 Pass
Find dishes that start with
5 1 Pass
the word ‘Bun’
Print and sort dishes from
6 1 Pass
expensive to cheap
Calculate the total amount
7 of all Bills from 10/10 to 1 Pass
13/10
• In the bill management window, the window will display information about the bill. When clicking, it will show
Total on the right to see the amount clearly. The bill includes the Id of the customer sitting at the table number
and date and time sitting there and the total amount.
1. Anon (n.d.) SQL Data Types, SQL data types for mysql, SQL Server, and MS access, [online] Available at:
https://www.w3schools.com/sql/sql_datatypes.asp (Accessed October 24, 2022).
2. Anon (2020) SQL Server Data types, SQL Server Tutorial, [online] Available at: https://www.sqlservertutorial.net/sql-server-
basics/sql-server-data-types/ (Accessed October 24, 2022).
3. Anon (n.d.) SQL Primary Key Constraint, [online] Available at: https://www.w3schools.com/sql/sql_primarykey.asp (Accessed
October 24, 2022).