logo

Data Base Design Question and Answer 2022

Assignment 1 for CIS 2002 course at USQ, Semester 1 2020. The assignment requires the submission of a data modelling and normalization assignment conforming to the USQ methodology.

9 Pages1259 Words21 Views
   

Added on  2022-09-25

Data Base Design Question and Answer 2022

Assignment 1 for CIS 2002 course at USQ, Semester 1 2020. The assignment requires the submission of a data modelling and normalization assignment conforming to the USQ methodology.

   Added on 2022-09-25

ShareRelated Documents
Running head: DATABASE DESIGN
DATABASE DESIGN
Name of the Student
Name of the University
Author Note
Data Base Design Question and Answer 2022_1
DATABASE DESIGN
1
Table of Contents
Section B –Queries..........................................................................................................................2
Section C – Data Modelling............................................................................................................4
Question 1....................................................................................................................................4
Question 2....................................................................................................................................4
Question 3....................................................................................................................................5
Question 4....................................................................................................................................6
Bibliography....................................................................................................................................7
Data Base Design Question and Answer 2022_2
DATABASE DESIGN
2
Section B –Queries
1. Write an SQL query that displays total number of customers (rename the field ‘Total
Customers’), number of customers without referrals (rename the field ‘Direct Customers’), and
number of referred customers (rename the field ‘Referred Customers’).
SELECT COUNT(customer#) AS "Total Customers" , SUM(CASE
WHEN referred IS NULL THEN 1 ELSE 0 END) AS "Direct
Customers", SUM(CASE WHEN referred IS NOT NULL THEN 1 ELSE
0 END) AS "Referred Customers" FROM customers;
2. Write a SQL query that displays customer number, last name, first name, and city for all
customers who reside in Florida and who have not been referred by another customer.
SELECT Customer#, Lastname, Firstname, City FROM customers
WHERE city='FLORIDA' AND referred IS NULL;
3. Display the full name of all the customers in a single column (by concatenating first name
followed by a comma then a space then last name), rename the filed ‘Customers’, region and
referred for all customers who live in any western region (that is in any region in the western
sector ‘W’, ‘SW’, ‘NW’) and who have been referred by another customer.
SELECT lastname||', '||firstname AS CUSTOMERS, Region,
referred FROM customers
WHERE region LIKE '%W%' AND referred IS NOT NULL;
Data Base Design Question and Answer 2022_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
COVER PAGE. Task 1. My Database select queries . Write
|7
|401
|297

Database Creation, Population and SQL Queries
|7
|1011
|14

Relational Database Systems
|13
|1904
|426

Using the General Hardware Corp. relational database to generate a batch of SQL Server scripts
|4
|1054
|212

SQL Final Exam
|3
|777
|265

Data Warehouse Design and Implementation
|17
|1547
|286