[go: up one dir, main page]

0% found this document useful (1 vote)
74 views3 pages

Create A Query To Display All The Data

The document contains SQL queries to retrieve data from database tables. The queries select and display data like customer details, package details, unique cities and states. Columns are renamed and calculations are performed on selected fields like multiplying monthly payments by 12 to get yearly payments. Customer name, phone numbers and address are concatenated into single fields.

Uploaded by

prime army
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
74 views3 pages

Create A Query To Display All The Data

The document contains SQL queries to retrieve data from database tables. The queries select and display data like customer details, package details, unique cities and states. Columns are renamed and calculations are performed on selected fields like multiplying monthly payments by 12 to get yearly payments. Customer name, phone numbers and address are concatenated into single fields.

Uploaded by

prime army
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

Create a query to display all the data from the Customers table.


SELECT * FROM customers

2. Create a query to display the internet package number, internet


speed and monthly payment

3. Create a query to display first name, last name, join date, monthly
discount, monthly discount after an addition of 20% and monthly
discount after a reduction of 20% SELECT first_name , last_name
, join_date , monthly_discount ,

monthly_discount * 1.2 AS 'DC_N' , monthly_discount * 0.6 AS


'DC_L'

FROM customers
Create a query to display the package number, speed, strt_date (the date
when the package became available), monthly payment, and monthly
payment * 12, name the last column “YearlyPayment” SELECT pack_id ,
speed, strt_date, monthly_payment,

monthly_payment * 12 AS 'Y_INCOME'
FROM packages

Create a query to display the last name concatenated with the first name,
separated by space, and main phone number concatenated with secondary
phone number, separated by comma and space. Name the column
heading FULL_NAME and CONTACT_DETAILS respectively.
(Customers table) SELECT first_name + ' ' + last_name AS 'FULL_NAME' ,
main_phone_num + ' , ' + secondary_phone_num AS 'CONTACT_DETAILS'
FROM customers

4. Create a query to display unique cities from the Customers table.


5. Create a query to display unique states from the Customers table.
6. Create a query to display the first name, last name, monthly
discount and city concatenated with street, separated by space.
Name the column headings: FN, LN, DC and FULL_ADDRESS
respectively (Customers table).
7. Create a query to display unique monthly discounts
in Customers tabl
SELECT* FROM customers

SELECT pack_id , speed, monthly_payment AS 'MP' FROM packages

SELECT first_name , last_name , join_date , monthly_discount ,


monthly_discount * 1.2 AS 'DC_N' , monthly_discount * 0.6 AS 'DC_L'
FROM customers

SELECT pack_id , speed, strt_date, monthly_payment,


monthly_payment * 12 AS 'Y_INCOME'
FROM packages

SELECT first_name + ' ' + last_name AS 'FULL_NAME' ,


main_phone_num + ' , ' + secondary_phone_num AS 'CONTACT_DETAILS'
FROM customers

SELECT DISTINCT city FROM customers

SELECT DISTINCT state FROM customers

SELECT DISTINCT state, city FROM customers

SELECT last_name + ' ' + state AS 'CUSTOMER_AND_STATE'FROM


customers

SELECT first_name AS 'FN' ,last_name AS 'LN' ,


monthly_discount AS 'DC' ,city + ' ' + street AS 'FULL_ADDRESS'
FROM customers

SELECT DISTINCT monthly_discount FROM customers

SELECT DISTINCT pack_idFROM customers

You might also like