×
Samples Blogs Make Payment About Us Reviews 4.9/5 Order Now

Create a Program to Alter Database Tables in SQL Assignment Solution

July 04, 2024
Katrina J. Lambdin
Katrina J.
🇺🇸 United States
Database
a PhD-qualified expert in Computer Science from Greenfield University, USA, has 8 years of experience in database assignments. Specialized in database design, optimization, and management, she delivers top-notch solutions for academic and professional needs.
Key Topics
  • Instructions
    • Objective
  • Requirements and Specifications
Tip of the day
Familiarize yourself with OCaml's pattern matching; it simplifies handling recursive data structures like lists and trees, making your code concise and easier to debug.
News
In 2024, Girls Who Code introduced a Data Science + AI track in their free summer programs for high school students, fostering skills in cybersecurity and creative coding​

Instructions

Objective

Write a SQL assignment program to alter database tables in SQL language.

Requirements and Specifications

CE3.1a Change Column Name, Test Name Change, Generate Summaries:

ACTIONRESULT
alter table T_CUST_2021rename column T_NAME to T_CNAME
desc T_CUST_2021
select O.T_ORDID, T_ORDATE, T_PID, T_QTYfrom T_ORD_2021 O inner join T_ORDLINE_2021 Lon O.T_ORDID= L.T_ORDID
select O.T_ORDID, T_ORDATE, T_PID, T_QTYfrom T_ORD_2021 O left outer join T_ORDLINE_2021 Lon O.T_ORDID = L.T_ORDID
select T_ORDID, T_ORDLINE, P.T_PID, T_PNAME, T_QTYfrom T_ORDLINE_2021 L right outer join T_PROD_2021 Pon L.T_PID = P.T_PID

CE3.1b - Insert Rows, Generate Summaries:

ACTIONRESULT
select T_NAME as CName, T_ORDLINE as LNID, T_PNAME as PName, T_QTY, T_UNIT_PRICE from T_ORD_2021 O inner join T_ORDLINE_2021 Lon O.T_ORDID = L.T_ORDIDinner join T_CUST_2021 C on O.T_CID = C.T_CIDinner join T_PROD_2021 P on L.T_PID = P.T_PIDorder by T_NAME, T_ORDLINE, T_PNAME
select T_NAME as CName, count(distinct T_PNAME) as No_of_Prods, sum(T_QTY *T_UNIT_PRICE) as Total_Dollarsfrom T_ORD_2021 O inner join T_ORDLINE_2021 Lon O.T_ORDID = L.T_ORDIDinner join T_CUST_2021 C on O.T_CID = C.T_CIDinner join T_PROD_2021 P on L.T_PID = P.T_PIDgroup by T_NAMEorder by T_NAME
select sum(T_QTY * T_UNIT_PRICE) as Overall_Total_Dollarsfrom T_ORDLINE_2021 L inner join T_PROD_2021 Pon L.T_PID = P.T_PID

Source Code

-- Part 2 -- Q1 SELECT C.course_name FROM course_table C, registration_table R, student_table S WHERE C.course_id = R.course_id AND R.student_id = S.student_id AND S.student_name = 'Smith'; -- Q2 SELECT F.faculty_name FROM faculty_table F INNER JOIN course_table C ON C.instructor_id = F.faculty_id INNER JOIN registration_table R ON C.course_id = R.course_id INNER JOIN student_table S ON R.student_id = S.student_id WHERE S.student_name = 'Baker' -- Q3 SELECT S.student_id, S.student_name, SUM(C.num_credits) FROM student_table S, registration_table R, course_table C WHERE R.student_id = S.student_id AND C.course_id = R.course_id GROUP BY S.student_name, S.student_id; -- Q4 SELECT F.faculty_name FROM faculty_table F, course_table C, registration_table R, student_table S WHERE F.faculty_id = C.instructor_id AND C.course_id = R.course_id AND R.student_id = S.student_id AND C.course_id = 'INFO 364' AND R.grade = 4;

Similar Samples

Explore our sample programming homework solutions to get a glimpse of our expertise. At ProgrammingHomeworkHelp.com, we deliver high-quality assignments in various programming languages. Our samples showcase clear problem-solving approaches and well-commented code, demonstrating our commitment to excellence and client satisfaction. Check them out to see how we can assist you with your programming challenges!