0% found this document useful (0 votes)
9 views

Lab Assignment

lab assignment

Uploaded by

Muneeba Iftikhar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Lab Assignment

lab assignment

Uploaded by

Muneeba Iftikhar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Lab Assignment

Excel

Perform the following on the given excel sheet.

Question 1: Color Scale Apply a color scale to the marks cells to visualize the
differences in their values?

Question 2: Nested IF Statement Write a nested IF statement to return


"Excellent" for scores 90 and above, "Good" for scores between 70 and 89,
"Average" for scores between 50 and 69, and "Poor" for scores below 50?

Question 3: Creating a Pie Chart Create a pie chart to show the proportion
of different categories in your data?

MYSQL

Question 4: You have two tables: students and courses.

1. The students table has the following columns:


 student_id (Primary Key)
 email (must be unique)
 name
 birthdate
 major
2. The courses table has the following columns:
 course_id (Primary Key)
 course_name
 credits
 instructor

Perform the following tasks using appropriate MySQL queries:

1. Create the students table with the specified columns and constraints.
2. Create the courses table with the specified columns and constraints.
3. Alter the students table to add a new column GPA of type DECIMAL (3,
2).
4. Populate the table student with atleast 10 enteries in the format:

student_id = SP24-BBD-001, email = '[email protected]',


name = 'John Doe', birthdate = '2000-01-01', major = 'Computer
Science', GPA = 3.5.

ID Email Name Birthdate Major GPA


SP21-
[email protected] Danial Computer
BCS- 2002-01-01 2.51
om Tahir Science
027
FA22-
ahmedmustafa21@exam Ahmed Data
BDA- 2001-03-15 3.37
ple.com Mustafa Analytics
068
SP23- [email protected] Saad 2004-07-22 Electrical 1.97
BEE- Engineerin
om Ahmed
003 g
FA21- Mechanical
mehm00dumer@exampl Umer
BME- 2001-11-30 Engineerin 3.62
e.com Mehmood
004 g
SP24-
amnahussain1@example Amna Computer
BCS- 2005-05-18 3.21
.com Hussain Science
005
FA23- Civil
hamza.hassan@example Hamza
BCE- 2002-08-10 Engineerin 3.91
.com Hassan
006 g
SP22-
[email protected] Mariam Mathematic
BIM- 2001-02-25 2.77
om Butt s
007
FA22- [email protected]
Bilal Mir 2004-12-05 Physics 3.13
BIP-008 om
SP21- [email protected] Zainab
2002-04-14 Chemistry 3.32
BIC-009 om Raza
FA22-
farhan.shaikh@example. Farhan Data
BDA- 2003-09-29 3.45
com Shaikh Analytics
010

5. Insert 5 courses into the courses table.

Course_
Course_name Credits Instructor
id
CS301 Database Systems 3 Ayesha Khan
Marketing
MGT201 3 Tariq Mehmood
Management
HUM10
Ethics and Civics 2 Sana Ahmed
1
CS102 Software Engineering 2 Bilal Qureshi
CS107 Data Analytics 3 Farah Saeed

6. Insert a new course with the following details:

course_id = MGT110, course_name = 'Data Structures', credits =


3, instructor = 'Asad Ullah'.

7. Select the names and GPAs of all students whose GPA is between 3.0 and
4.0, and whose major is either 'Computer Science' or 'Data Analytics'.
8. Update the students table to set the major to 'Software Engineering' for
the student with student_id = SP22-BIM-007.
9. Select all columns from students where the GPA is greater than 3.2,
ordered by name in ascending order.
10. Suppose you have a table named student_courses to store the
courses taken by each student. The student_courses table has the
following columns:
 student_id: Foreign key referencing the student_id column in the
students table.
 course_id: Foreign key referencing the course_id column in the courses
table.

Write SQL INSERT INTO statements to assign the following courses to each
student:

Student_id Course_id
SP21- BCS-027 MGT110
FA22- BDA-068 MGT201
SP23- BEE-003 HUM101
FA21-BME-004 CS102
FA21-BME-004 CS107
FA23-BCE-006 CS301
SP22-BIM-007 MGT201
FA22-BIP-008 HUM101
SP21-BIC-009 CS102
FA22-BDA-010 CS107
SP21- BCS-027 CS301
FA22- BDA-068 MGT201
SP23- BEE-003 MGT110

11. Write an SQL query to find the total number of courses taken by
each student. Include the student's name and the total number of
courses. Ensure that students who haven't taken any courses are also
included in the result.(left join).

You might also like