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

SQL Table Creation Examples

The document provides SQL commands to create and populate ten different tables: Student, Employee, Library, Course, Hospital, Supplier, Exam, BankAccount, Vehicle, and Attendance. Each table includes specific fields with data types and an example of an insertion for each. The tables cover various domains such as education, healthcare, finance, and transportation.

Uploaded by

kumkumsingh79856
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)
8 views3 pages

SQL Table Creation Examples

The document provides SQL commands to create and populate ten different tables: Student, Employee, Library, Course, Hospital, Supplier, Exam, BankAccount, Vehicle, and Attendance. Each table includes specific fields with data types and an example of an insertion for each. The tables cover various domains such as education, healthcare, finance, and transportation.

Uploaded by

kumkumsingh79856
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

Section F: Lab-Based Table Structure Questions

1. Create a table named `Student` with the following fields:

| Roll_No | Name | Age | Grade | Percentage |


CREATE TABLE Student (
Roll_No INT PRIMARY KEY,
Name VARCHAR(50),
Age INT,
Grade CHAR(1),
Percentage DECIMAL(5,2)
);

INSERT INTO Student VALUES (1, 'Amit', 15, 'A', 89.75);

2. Create a table named `Employee` with the following fields:

| Emp_ID | Emp_Name | Department | Salary | DOJ |


CREATE TABLE Employee (
Emp_ID INT PRIMARY KEY,
Emp_Name VARCHAR(100),
Department VARCHAR(50),
Salary DECIMAL(10,2),
DOJ DATE
);

INSERT INTO Employee VALUES (101, 'Riya Sharma', 'IT', 35000.00, '2022-06-15');

3. Create a table named `Library` with the following fields:

| Book_ID | Title | Author | Price | Copies |


CREATE TABLE Library (
Book_ID INT PRIMARY KEY,
Title VARCHAR(100),
Author VARCHAR(50),
Price DECIMAL(6,2),
Copies INT
);

INSERT INTO Library VALUES (1001, 'Wings of Fire', 'A.P.J. Abdul Kalam', 299.99, 10);

4. Create a table named `Course` with the following fields:


| Course_ID | Course_Name | Duration | Fees |
CREATE TABLE Course (
Course_ID INT PRIMARY KEY,
Course_Name VARCHAR(100),
Duration VARCHAR(20),
Fees DECIMAL(8,2)
);

INSERT INTO Course VALUES (1, 'Python Programming', '3 Months', 7500.00);

5. Create a table named `Hospital` with the following fields:

| Patient_ID | Name | Age | Disease | Admit_Date |


CREATE TABLE Hospital (
Patient_ID INT PRIMARY KEY,
Name VARCHAR(50),
Age INT,
Disease VARCHAR(50),
Admit_Date DATE
);

INSERT INTO Hospital VALUES (501, 'Anita Verma', 32, 'Flu', '2025-07-20');

6. Create a table named `Supplier` with the following fields:

| Supplier_ID | Name | City | Contact_No |


CREATE TABLE Supplier (
Supplier_ID INT PRIMARY KEY,
Name VARCHAR(50),
City VARCHAR(30),
Contact_No VARCHAR(15)
);

INSERT INTO Supplier VALUES (301, 'Mohan Traders', 'Delhi', '9876543210');

7. Create a table named `Exam` with the following fields:

| Exam_ID | Subject | Date | Max_Marks |


CREATE TABLE Exam (
Exam_ID INT PRIMARY KEY,
Subject VARCHAR(30),
Date DATE,
Max_Marks INT
);
INSERT INTO Exam VALUES (1, 'Mathematics', '2025-08-01', 100);

8. Create a table named `BankAccount` with the following fields:

| Acc_No | Name | Balance | Account_Type |


CREATE TABLE BankAccount (
Acc_No INT PRIMARY KEY,
Name VARCHAR(50),
Balance DECIMAL(10,2),
Account_Type VARCHAR(20)
);

INSERT INTO BankAccount VALUES (2001, 'Neha Jain', 15000.00, 'Savings');

9. Create a table named `Vehicle` with the following fields:

| Vehicle_ID | Model | Company | Price |


CREATE TABLE Vehicle (
Vehicle_ID INT PRIMARY KEY,
Model VARCHAR(30),
Company VARCHAR(30),
Price DECIMAL(10,2)
);

INSERT INTO Vehicle VALUES (1010, 'i20', 'Hyundai', 800000.00);

10. Create a table named `Attendance` with the following fields:

| Student_ID | Date | Status |


CREATE TABLE Attendance (
Student_ID INT,
Date DATE,
Status VARCHAR(10)
);

INSERT INTO Attendance VALUES (1, '2025-07-24', 'Present');

You might also like