0% found this document useful (0 votes)
20 views1 page

SQL 2 Lab

The document outlines SQL commands to create a database named 'players' and a table 'student' with various attributes for student records. It includes commands to insert multiple student entries, update a student's first name, and drop a column and the table itself. The document also contains a verification step to check the update made to the student record.
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 (0 votes)
20 views1 page

SQL 2 Lab

The document outlines SQL commands to create a database named 'players' and a table 'student' with various attributes for student records. It includes commands to insert multiple student entries, update a student's first name, and drop a column and the table itself. The document also contains a verification step to check the update made to the student record.
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

create database players

use players
create table student
(
StudentID INT PRIMARY KEY, -- Primary key
FirstName NVARCHAR(50) NOT NULL, -- First name of the student
LastName NVARCHAR(50) NOT NULL, -- Last name of the student
DateOfBirth DATE, -- Date of birth
Gender CHAR(1), -- Gender (M/F)
EnrollmentDate DATE, -- Date of enrollment
Email NVARCHAR(100), -- Email address
PhoneNumber NVARCHAR(15), -- Phone number
Address NVARCHAR(255) -- Address
);

INSERT INTO student (StudentID, FirstName, LastName, DateOfBirth, Gender,


EnrollmentDate, Email, PhoneNumber, Address)
VALUES
(1, 'John', 'Doe', '2000-01-15', 'M', '2018-09-01', '[email protected]', '123-
456-7890', '123 Main St, Anytown, USA'),
(2, 'Jane', 'Smith', '1999-05-23', 'F', '2017-09-01', '[email protected]',
'234-567-8901', '456 Oak St, Othertown, USA'),
(3, 'Alice', 'Johnson', '2001-02-10', 'F', '2019-09-01',
'[email protected]', '345-678-9012', '789 Pine St, Sometown, USA'),
(4, 'Bob', 'Brown', '2000-07-19', 'M', '2018-09-01', '[email protected]',
'456-789-0123', '101 Maple St, Anycity, USA');

UPDATE student
SET FirstName = 'Ali'
WHERE StudentID = 2;

-- Verify the update


SELECT * FROM student WHERE StudentID = 2;
ALTER TABLE student
DROP COLUMN PhoneNumber;
DROP TABLE student;

select * from student

You might also like