0% found this document useful (0 votes)
11 views3 pages

DBMS PR1

The document outlines the creation of two tables, Students and Courses, with specified fields and sample data for each. It includes SQL queries to select student full names and genders, course details, courses with more than three credits, and an update to a student's email address. Additionally, it provides example insert statements to populate the tables with ten records each.

Uploaded by

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

DBMS PR1

The document outlines the creation of two tables, Students and Courses, with specified fields and sample data for each. It includes SQL queries to select student full names and genders, course details, courses with more than three credits, and an update to a student's email address. Additionally, it provides example insert statements to populate the tables with ten records each.

Uploaded by

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

1.

Create Tables:

Students student_id (INT, Primary Key) first_name (VARCHAR) last_name (VARCHAR)


gender (VARCHAR) email (VARCHAR)

Courses course_id (INT, Primary Key) course_name (VARCHAR) course_code (VARCHAR)


credits (INT)

NOTE:Insert 10 records

1. Write a query to select all students and display their full name (first name + last name),
and gender.

2. Write a query to select all courses and display the course name, course code, and the
number of credits.

3. Write a query to select all courses with more than 3 credits.

4. Write a query to update the email address of Student 1 (John Doe) to


[email protected]

INSERT INTO Students (student_id, first_name, last_name, gender, email) VALUES

(1, 'Alice', 'Johnson', 'Female', '[email protected]'),

(2, 'Bob', 'Smith', 'Male', '[email protected]'),

(3, 'Charlie', 'Brown', 'Male', '[email protected]'),

(4, 'Diana', 'Prince', 'Female', '[email protected]'),

(5, 'Evan', 'Davis', 'Male', '[email protected]'),

(6, 'Fiona', 'Garcia', 'Female', '[email protected]'),

(7, 'George', 'Wilson', 'Male', '[email protected]'),

(8, 'Hannah', 'Lee', 'Female', '[email protected]'),

(9, 'Ian', 'Martinez', 'Male', '[email protected]'),

(10, 'Jenna', 'Taylor', 'Female', '[email protected]');

INSERT INTO Courses (course_id, course_name, course_code, credits) VALUES

(1, 'Introduction to Computer Science', 'CS101', 4),


(2, 'Calculus I', 'MATH101', 4),

(3, 'English Literature', 'ENG201', 3),

(4, 'Physics I', 'PHY101', 4),

(5, 'World History', 'HIST101', 3),

(6, 'Chemistry I', 'CHEM101', 4),

(7, 'Principles of Economics', 'ECON101', 3),

(8, 'Introduction to Psychology', 'PSY101', 3),

(9, 'Software Engineering', 'CS301', 4),

(10, 'Art Appreciation', 'ART101', 2);

1)Write a query to select all students and display their full name (first name + last name),

and gender.

SELECT first_name || ' ' || last_name AS full_name,gender

FROM Students;

2. Write a query to select all courses and display the course name, course code, and the

number of credits.

SELECT course_name,course_code,credits FROM Courses;

3. Write a query to select all courses with more than 3 credits.

SELECT course_name,course_code,credits

FROM CoursesW HERE credits > 3;

4. Write a query to update the email address of Student 1 (John Doe) to

[email protected].
UPDATE Students SET email = '[email protected]'

WHERE student_id = 1;

You might also like