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

Home Assignment 1

The document describes the creation of tables for a digital bus pass database using SQL queries. It includes tables for user login credentials, user information linked to bus passes, and details tables for students, citizens, senior citizens. Records are inserted into each table with sample data. Queries are also used to view the structure and data of each created table.

Uploaded by

Purva
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)
30 views

Home Assignment 1

The document describes the creation of tables for a digital bus pass database using SQL queries. It includes tables for user login credentials, user information linked to bus passes, and details tables for students, citizens, senior citizens. Records are inserted into each table with sample data. Queries are also used to view the structure and data of each created table.

Uploaded by

Purva
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/ 7

Name-Neha Patil

PRN-72167840J

Roll No-23151

Home Assignment 1
Analyze and Design database using ER Model for any real-time application
and convert the same into tables.
ER diagram of DigitalBuspass-

>Queries for Tables-


mysql> create table login(id int primary key,email varchar(100) not null,password varchar(20) not
null);

Query OK, 0 rows affected (0.63 sec)

mysql> insert into login values(1,'[email protected]','1234567');

Query OK, 1 row affected (0.45 sec)


mysql> insert into login values(2,'[email protected]','vijaya12');

Query OK, 1 row affected (0.21 sec)

mysql> insert into login values(3,'[email protected]','patil876');

Query OK, 1 row affected (0.21 sec)

mysql> insert into login values(4,'[email protected]','0908767');

Query OK, 1 row affected (0.25 sec)

mysql> insert into login values(5,'[email protected]','sid5678');

Query OK, 1 row affected (0.12 sec)

mysql> select * from login;

+----+---------------------+----------+

| id | email | password |

+----+---------------------+----------+

| 1 | [email protected] | 1234567 |

| 2 | [email protected] | vijaya12 |

| 3 | [email protected] | patil876 |

| 4 | [email protected] | 0908767 |

| 5 | [email protected] | sid5678 |

+----+---------------------+----------+

5 rows in set (0.10 sec)

mysql> create table Passusers(id int primary key,email varchar(100) not null ,category varchar(20));

Query OK, 0 rows affected (1.85 sec)

mysql> insert into Passusers values(1,'[email protected]','Student');

Query OK, 1 row affected (0.33 sec)

mysql> insert into Passusers values(2,'[email protected]','Senior Citizen');


Query OK, 1 row affected (0.17 sec)

mysql> insert into Passusers values(3,'[email protected]','Citizen');

Query OK, 1 row affected (0.10 sec)

mysql> insert into Passusers values(4,'[email protected]','Citizen');

Query OK, 1 row affected (0.18 sec)

mysql> insert into Passusers values(5,'[email protected]','Student');

Query OK, 1 row affected (0.07 sec)

mysql> select * from Passusers;

+----+---------------------+----------------+

| id | email | category |

+----+---------------------+----------------+

| 1 | [email protected] | Student |

| 2 | [email protected] | Senior Citizen |

| 3 | [email protected] | Citizen |

| 4 | [email protected] | Citizen |

| 5 | [email protected] | Student |

+----+---------------------+----------------+

5 rows in set (0.00 sec)

mysql> create table Student(id int primary key,Name varchar(100) not null ,Phone_Number
varchar(10) not null,Adharcard_Number varchar(16) not null,Age int not null);

Query OK, 0 rows affected (1.85 sec)

mysql> insert into Student values(1,'Neha Patil','9075954788','123456789012',20);

Query OK, 1 row affected (0.22 sec)

mysql> insert into Student values(5,'Siddhant Palve','4563278958','678954346789',18);

Query OK, 1 row affected (0.23 sec)


mysql> select * from Student;

+----+----------------+--------------+------------------+-----+

| id | Name | Phone_Number | Adharcard_Number | Age |

+----+----------------+--------------+------------------+-----+

| 1 | Neha Patil | 9075954788 | 123456789012 | 20 |

| 5 | Siddhant Palve | 4563278958 | 678954346789 | 18 |

+----+----------------+--------------+------------------+-----+

2 rows in set (0.10 sec)

mysql> create table Citizen(id int primary key,Name varchar(100) not null ,Phone_Number
varchar(10) not null,Adharcard_Number varchar(16) not null,Age int not null);

Query OK, 0 rows affected (1.75 sec)

mysql> insert into Citizen values(3,'Sanjay Patil','5692345612','984532346789',35);

Query OK, 1 row affected (0.17 sec)

mysql> create table Buspass(id int primary key,fromdate Date not null,till_date Date not
null,Passtype varchar(20));

Query OK, 0 rows affected (1.02 sec)

mysql> insert into Buspass values(1,'2021-01-12','2021-02-12','Allroute');

Query OK, 1 row affected (0.07 sec)

mysql> insert into Buspass values(2,'2021-04-17','2021-05-17','Allroute');

Query OK, 1 row affected (0.17 sec)

mysql> insert into Buspass values(3,'2021-03-21','2021-04-21','Oneroute');

Query OK, 1 row affected (0.12 sec)

mysql> insert into Buspass values(4,'2021-08-26','2021-09-26','Oneroute');

Query OK, 1 row affected (0.23 sec)


mysql> insert into Buspass values(5,'2021-10-13','2021-11-13','Allroute');

Query OK, 1 row affected (0.17 sec)

mysql> select * from Buspass;

+----+------------+------------+----------+

| id | fromdate | till_date | Passtype |

+----+------------+------------+----------+

| 1 | 2021-01-12 | 2021-02-12 | Allroute |

| 2 | 2021-04-17 | 2021-05-17 | Allroute |

| 3 | 2021-03-21 | 2021-04-21 | Oneroute |

| 4 | 2021-08-26 | 2021-09-26 | Oneroute |

| 5 | 2021-10-13 | 2021-11-13 | Allroute |

+----+------------+------------+----------+

5 rows in set (0.00 sec)

mysql> insert into Citizen values(4,'Jayshree More','9854345678','762314563212',41);

Query OK, 1 row affected (0.26 sec)

mysql> select * from Citizen;

+----+---------------+--------------+------------------+-----+

| id | Name | Phone_Number | Adharcard_Number | Age |

+----+---------------+--------------+------------------+-----+

| 3 | Sanjay Patil | 5692345612 | 984532346789 | 35 |

| 4 | Jayshree More | 9854345678 | 762314563212 | 41 |

+----+---------------+--------------+------------------+-----+

2 rows in set (0.00 sec)

mysql> create table Senior_Citizen(id int primary key,Name varchar(100) not null ,Phone_Number
varchar(10) not null,Adharcard_Number varchar(16) not null,Age int not null);

Query OK, 0 rows affected (1.67 sec)


mysql> insert into Senior_Citizen values(2,'Vijaya Narhe','5674321908','234563218907',64);

Query OK, 1 row affected (0.16 sec)

mysql> select * from Senior_Citizen;

+----+--------------+--------------+------------------+-----+

| id | Name | Phone_Number | Adharcard_Number | Age |

+----+--------------+--------------+------------------+-----+

| 2 | Vijaya Narhe | 5674321908 | 234563218907 | 64 |

+----+--------------+--------------+------------------+-----+

1 row in set (0.11 sec)

Snapshots of tables-

You might also like