0% found this document useful (0 votes)
81 views20 pages

1) Introduction:: Data Design and Modeling Database Management System Software End Users

The document describes a database management system project on designing and implementing a database. It includes sections on introduction to databases and DBMS, applications of database systems like railway reservations and libraries, database architecture showing different levels, advantages and disadvantages of DBMS, database languages including SQL, and important SQL commands like SELECT, WHERE, INSERT, UPDATE, and DELETE.

Uploaded by

Shivam Upadhyay
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)
81 views20 pages

1) Introduction:: Data Design and Modeling Database Management System Software End Users

The document describes a database management system project on designing and implementing a database. It includes sections on introduction to databases and DBMS, applications of database systems like railway reservations and libraries, database architecture showing different levels, advantages and disadvantages of DBMS, database languages including SQL, and important SQL commands like SELECT, WHERE, INSERT, UPDATE, and DELETE.

Uploaded by

Shivam Upadhyay
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
You are on page 1/ 20

PUNE INSTITUTE OF COMPUTER TECHNOLOGY

PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII

ROLL NO:32339 DATE:

CLASS:TE7 SUBJECT:ESD

TITLE:DESIGN AND IMPLEMENTATION OF “DATABASE MANAGEMENT SYSTEM”.

1] INTRODUCTION:

A database is an organized collection of data, generally stored and


accessed electronically from a computer system. Where databases
are more complex they are often developed using formal design
and modeling techniques.
The database management system (DBMS) is the software that
interacts with end users, applications, and the database itself to
capture and analyze the data. The DBMS software additionally
encompasses the core facilities provided to administer the
database. The sum total of the database, the DBMS and the
associated applications can be referred to as a "database system".
Often the term "database" is also used to loosely refer to any of the
DBMS, the database system or an application associated with the
database.
PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII

APPLICATION OF DATABASE SYSTEM


1. Railway Reservation System
Database is required to keep record of ticket booking, train’s departure and arrival status.
Also if trains get late then people get to know it through database update.

2. Library Management System


There are thousands of books in the library so it is very difficult to keep record of all the
books in a copy or register. So DBMS used to maintain all the information relate to book
issue dates, name of the book, author and availability of the book.

3. Universities and colleges


Examinations are done online today and universities and colleges maintain all these
records through DBMS. Student’s registrations details, results, courses and grades all the
information are stored in

4. Credit card transactions


For purchase of credit cards and all the other transactions are made possible only by
DBMS. A credit card holder knows the importance of their information that all are secured
through DBMS.

5.Social Media Sites


As most of the people are on social media websites to share their views and connect with
friends. Daily millions of users signed up for these social media accounts like facebook,
twitter, pinterest and Google plus.all of them use database management.

6.Telecommunications
Any telecommunication company cannot even think about their business without DBMS.
DBMS is must for these companies to store the call details and monthly post paid bills.
PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII

3] view of data

In the above diagram,


 It shows the architecture of DBMS.
 Mapping is the process of transforming request response
between various database levels of architecture.
 Mapping is not good for small database, because it takes more
time.
 In External / Conceptual mapping, DBMS transforms a request
on an external schema against the conceptual schema.
PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII

1. Physical Level
 Physical level describes the physical storage structure of data in
database.
 It is also known as Internal Level.
 This level is very close to physical storage of data.
 At lowest level, it is stored in the form of bits with the physical
addresses on the secondary storage device.
 At highest level, it can be viewed in the form of files.
 The internal schema defines the various stored data types. It
uses a physical data model.
2. Conceptual Level
 Conceptual level describes the structure of the whole database
for a group of users.
 It is also called as the data model.
 Conceptual schema is a representation of the entire content of
the database.
 These schema contains all the information to build relevant
external records.
 It hides the internal details of physical storage.
3. External Level
 External level is related to the data which is viewed by individual
end users.
 This level includes a no. of user views or external schemas.
 This level is closest to the user.
 External view describes the segment of the database that is
required for a particular user group and hides the rest of the database
from that user group.
PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII

4.] Advantages of DBMS 

• An organized and comprehensiveness of recording the result of the firms


activities.
• A receiver of data to be used in meeting the information requirement of the
MIS users.
• Reduced data redundancy.
• Reduced updating errors and increased consistency.
• Greater data integrity and independence from applications programs.
• Improved data access to users through use of host and query languages.
• Improved data security.
• Reduced data entry, storage, and retrieval costs.
• Facilitated development of new applications program.
• Standard can be enforced: Standardized stored data format is particularly
desirable as an old data to interchange or migration (change) between the
system.
• Conflicting requirement can be handled.

5.]Disadvantages of DBMS : 

• It increases opportunity for person or groups outside the organization to gain


access to information about the firms operation.
• It increases opportunity for fully training person within the organization to
misuse the data resources intentionally.
• The data approach is a costly due to higher H/W and S/W requirements.
• Database systems are complex (due to data independence), difficult, and
time-consuming to design..
PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII

5] DATABASE LANGUAGES
Database Languages are used to create and maintain database on computer. There are
large numbers of database languages like Oracle, MySQL, MS Access, dBase, FoxPro
etc. SQL statements commonly used in Oracle and MS Access can be categorized as
data definition language (DDL), data control language (DCL) and data manipulation
language (DML).

Data Definition Language (DDL) 


It is a language that allows the users to define data and their relationship to
other types of data. It is mainly used to create files, databases, data dictionary
and tables within databases.
It is also used to specify the structure of each table, set of associated values
with each attribute, integrity constraints, security and
authorization information for each table and physical storage structure of each
table on disk.

Data Manipulation Language (DML)


 It is a language that provides a set of operations to support the basic data
manipulation operations on the data held in the databases. It allows users to
insert, update, delete and retrieve data from the database. The part of DML
that involves data retrieval is called a query language.

Data Control Language (DCL)


DCL statements control access to data and the database using statements such
as GRANT and REVOKE. A privilege can either be granted to a User with the
help of GRANT statement. The privileges assigned can be SELECT, ALTER,
DELETE, EXECUTE, INSERT, INDEX etc. In addition to granting of
privileges, you can also revoke (taken back) it by using REVOKE command.

6.] SQL
Structured Query language is a standard database language which is used to create ,
maintain and retrieve the relational database SQL can :
1.Execute queries against a database.
2. Retrieve data from a database.
PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII
3.Insert and update records in a database.

Some of the most important SQL commands:

1] SELECT- extracts data from databases.The data returned is stored in a result table, called
the result set.

Syntax: SELECT column 1,column 2,…

FROM table_column;

2] WHERE-clause: Is used to filter the records.

The where clause is used to extract only those that fulfil a specified condition.

Syntax: SELECT column 1,column 2,…

FROM table_column;

Where condition;

3] INSERT INTO: Statement is used to insert new records in a table .There are two ways .The
first way specifies both columns and values .

Syntax:

INSERT INTO table_name (column1,……)

VALUES(value 1,……);

4]UPDATE: Statement is used to modify the existing records in a table

Syntax: update table_name

SET column1= value1,column2=value 2)

5]DELETE: Statement is used to delete the existing records in a table.

Syntax: DELETE FROM table_name

Where condition;

6]CREATE DATABASE :CREATE DATABASE Statement is used to create a new database.

Syntax:
PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII
CREATE DATABASE DATABASE_NAME;

7.]DROP DATABASE: IS USED TO DROP AN EXISTING DATABASE.

SYNTAX: DROP DATABASE DATABASE_NAME;

8.]CREATE TABLE: IS USED TO CREATE A NEW TABLE.

SYNTAX: CREATE TABLE TABLE_NAME;

9.]ALTER TABLE: IS USED TO ADD ,DELETE,OR MODIFY COLUMNS IN A EXISTING TABLE.

SYNTAX: ALTER TABLE table_name

ADD column_name datatype;

CODE:
password: ****

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 19

Server version: 8.0.17 MySQL Community Server - GPL

mysql> create database esd;

Query OK, 1 row affected (0.12 sec)

mysql> use esd

Database changed

mysql> show tables;

Empty set (0.03 sec)

mysql> create table resistance(

-> r_id INT NOT NULL AUTO_INCREMENT,

-> r_name VARCHAR(20),

-> r_value INT NOT NULL,

-> tolerance INT NOT NULL,


PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII
->
type VARCHAR(40),

-> power FLOAT(5,4) NOT NULL,

-> quantity INT,

-> cost FLOAT(5,3),

-> PRIMARY KEY(r_id)

-> );

Query OK, 0 rows affected, 2 warnings (1.52 sec)

mysql> INSERT INTO resistance(r_name,r_value,tolerance,type,power,quantity,cost) VALUES

->(“0.5 ohm”, 1 , 1 ,”metal film”, 1 , 100 ,1.84),

->(“5k ohm”, 5000 , 1 ,”metal film”, 0.25 , 100, 0.41),

->(“50k ohm”, 5000 , 1 ,”metal film”, 0.25 , 100, 0.48),

->(“3.3k ohm”, 3300 , 1 ,”metal film”, 0.25 , 100, 0.48),

->(“1.5k ohm”, 1500 , 1 ,”metal film”, 0.25 , 100, 0.48),

->(“50 ohm”, 50 , 1 ,”carbon metal film”, 0.25 , 100, 0.32),

->(“4.7k ohm”, 4700 , 1 ,”metal film”, 0.25 , 100, 0.48),

->(“1M ohm”, 100000 , 5 ,”carbon film”, 1 , 100, 1.35),

->(“10k ohm pot”, 10000 , 5 ,”cement”, 0.5 , 100, 4.16),

->(“1M ohm”, 100000 , 1 ,”cement”, 0.25 , 100, 4.35);

Query Ok, 10 rows affected (0.92sec)

Records: 10 Duplicates:0 Warnings:0


PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII

mysql> select * from resistance;

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

| r_id | r_name | r_value | tolerance | type | power | quantity | cost |

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

| 1 | 0.5 ohm | 1 | 1 | metal film | 1.0000 | 100 | 1.840 |

| 2 | 5k ohm | 5000 | 1 | metal film | 0.2500 | 100 | 0.410 |

| 3 | 50k ohm | 5000 | 1 | metal film | 0.2500 | 100 | 0.480 |

| 4 | 3.3k ohm | 3300 | 1 | metal film | 0.2500 | 100 | 0.480 |

| 5 | 1.5k ohm | 1500 | 1 | metal film | 0.2500 | 100 | 0.480 |

| 6 | 50 ohm | 50 | 1 | carbon metal film | 0.2500 | 100 | 0.320 |

| 7 | 4.7k ohm | 4700 | 1 | metal film | 0.2500 | 100 | 0.480 |

| 8 | 1M ohm | 100000 | 5 | carbon film | 1.0000 | 100 | 1.350 |

| 9 | 10k pot | 100000 | 5 | cement | 0.5000 | 100 | 4.160 |

| 10 | 1M ohm | 100000 | 1 | cement | 0.2500 | 100 | 4.350 |

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

10 rows in set (0.00 sec)

mysql> create table capacitors

-> ( c_id INT NOT NULL AUTO_INCREMENT,

-> c_name VARCHAR(20),

-> capacitance INT NOT NULL,

-> tolerance INT,

-> voltage INT NOT NULL,


PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII
->
type VARCHAR(20) NOT NULL,

-> quantity INT,

-> cost FLOAT(5,3),

-> PRIMARY KEY(c_id)

-> );

Query OK, 0 rows affected, 1 warning (0.50 sec)

mysql> INSERT INTO capacitors(c_name,c_value,tolerance,voltage,type,quantity,cost)


VALUES

->(“200uf”, 200000 , 10, 100 , “electrolytic” , 100 , 4.50),

->(“100uf”, 100000 , 20, 63 , “electrolytic” , 100 , 4.50),

->(“0.001uf”, 1 , 20, 50 , “ceramic” , 100 , 5),

->(“0.01uf”, 10 , 20, 50 , “ceramic” , 100 , 5),

->(“10uf”, 1000 , 10, 25 , “ceramic” , 100 , 5),

->(“10nf”, 10 , 10, 63 , “ceramic” , 100 , 4.5),

->(“4.7nf”, 47 , 10, 25 , “ceramic” , 100 , 18);

Query Ok, 7 rows affected(0.04 sec)

Records: 7 Duplicates: 0 Warnings : 0

mysql> select * from capacitors;

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

| c_id | c_name | capacitance | tolerance | voltage | type | quantity | cost |

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

| 1 | 200uf | 200000 | 10 | 100 | electrolyte | 100 | 4.500 |

| 2 | 100uf | 100000 | 20 | 63 | electrolyte | 100 | 4.500 |


PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII
|
3 | 0.001uf | 1 | 20 | 63 | ceramic | 100 | 5.000 |

| 4 | 0.01uf | 10 | 20 | 50 | ceramic | 100 | 5.000 |

| 5 | 10uf | 10000 | 10 | 25 | ceramic | 100 | 5.000 |

| 6 | 10nf | 10 | 10 | 63 | ceramic | 100 | 4.500 |

| 7 | 4.7nf | 47 | 10 | 25 | ceramic | 100 | 10.000 |

7 rows in set (0.00 sec)

mysql> create table ic(

-> ic_id INT NOT NULL AUTO_INCREMENT,

-> ic_name VARCHAR(20) NOT NULL,

-> package_type VARCHAR(50) NOT NULL,

-> cost FLOAT(5,3),

-> PRIMARY KEY(ic_id)

-> );

Query OK, 0 rows affected, 1 warning (0.90 sec)

mysql> INSERT INTO ic(ic_name,package_type,cost,) VALUES

->(“LM358”,”DIP-8”,100),

->(“LM3524”,”DIP-16”,20);

Query Ok, 2 rows affected(0.04 sec)

Records: 2 Duplicates: 0 Warnings : 0

mysql> select * from ic;

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

| ic_id | ic_name | package_type | cost |

+-------+-------------+--------------------+--------+
PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII
|
1 | LM3524 | DIP-16 | 45.000 |

| 2 | LM358 | DIP-8 | 25.000 |

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

2 rows in set (0.00 sec)

mysql> create table diode(

-> d_id INT NOT NULL,

-> d_name VARCHAR(50) NOT NULL,

-> cost FLOAT(5,3),

-> ifsm FLOAT(5,3),

-> Vrms INT,

-> Irm FLOAT(3,2),

-> Vfm FLOAT(3,2),

-> quantity INT,

-> PRIMARY KEY(d_id)

-> );

Query OK, 0 rows affected, 4 warnings (0.81 sec)

mysql> INSERT INTO diode(d_name, cost, ifsm, Vrms, Irm, Vfm,quantity ) VALUES

->(“BYV26A” , 5 , 30 , 200 , 0.1 , 2.5 , 100 ),

->(“SR30” , 5 , 3 , 14 , 0.5 , 0.55 , 100 ),

->(“BA159” , 5 , 30 , 700 , 5 , 1.3 , 100 );

Query Ok, 3 rows affected(0.04 sec)

Records: 3 Duplicates: 0 Warnings : 0


PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII

mysql> SELECT * FROM diode;

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

| d_id | d_name | cost | Ifsm | Vrms | Irm | Vfm | quantity |

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

| 1 | BYV26A | 5.000 | 30.000 | 200 | 0.10 | 2.50 | 100 |

| 2 | SR30 | 5.000 | 3.000 | 14 | 0.50 | 0.55 | 100 |

| 3 | BC556 | 5.000 | 30.000 | 700 | 5.00 | 1.30 | 100 |

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

3 rows in set (0.00 sec)

mysql> create table orders(

-> order_id INT NOT NULL AUTO_INCREMENT,

-> order_no INT NOT NULL,

-> c_id INT,

-> r_id INT,

-> ic_id INT,

-> d_id INT,

-> t_id INT,

-> i_id INT,


PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII
->
quantity INT NOT NULL,

-> PRIMARY KEY (order_id)

-> );

Query OK, 0 rows affected (0.79 sec)

mysql> INSERT INTO orders(order_no,c_id,quantity) VALUES (1,3,1),(1,4,1),(1,2,1);

Query Ok, 3 rows affected(0.04 sec)

Records: 3 Duplicates: 0 Warnings : 0

mysql> INSERT INTO orders(order_no,r_id,quantity) VALUES (1,2,4),(1,5,1),(1,6,1),(10,3,1);

Query Ok, 4 rows affected(0.04 sec)

Records: 4 Duplicates: 0 Warnings : 0

mysql> INSERT INTO orders(order_no,t_id,quantity) VALUES (1,2,1);

Query Ok, 1 rows affected(0.04 sec)

mysql> INSERT INTO orders(order_no,d_id,quantity) VALUES (1,3,1);

Query Ok, 1 rows affected(0.04 sec)

mysql> INSERT INTO orders(order_no,ic_id,quantity) VALUES (1,2,1);

Query Ok, 1 rows affected(0.04 sec)

mysql> INSERT INTO orders(order_no,i_id,quantity) VALUES (1,16,1);

Query Ok, 1 rows affected(0.04 sec)

mysql> create table inductor(

-> i_id INT NOT NULL AUTO_INCREMENT,

-> i_name VARCHAR(20),

-> cost INT,

-> tolerance INT,


PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII
->
DCCurrent INT,

-> DCResistance FLOAT(5,3),

-> frequency FLOAT(5,3),

-> quantity INT,

-> PRIMARY KEY(i_id)

-> );

Query OK, 0 rows affected, 2 warnings (0.74 sec)

mysql> INSERT INTO inductor(i_name, cost, tolerance, DCCurrent, DCResistance,


frequency,quantity )

->VALUES (“500uH”, 37 , 2 , 93 , 20 , 70.000 ,100 ),

->VALUES (“100uH”, 28 , 3 , 7 , 30 , 10.000 ,10 );

->VALUES (“700uH”, 43 , 10 , 375 , 10 , 14.000 ,10 ),

->VALUES (“300uH”, 20 , 1 , 45 , 20 , 17.000,100 );

Query Ok, 4 rows affected(0.04 sec)

Records: 4 Duplicates: 0 Warnings : 0

mysql> select * from inductor;

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

| i_id | i_name | cost | tolerance | DCCurrent | DCResistance | frequency | quantity |

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

| 1 | 500uH | 37 | 2 | 93 | 20.000 | 70.000 | 100 |

| 2 | 100uH | 28 | 3 | 7 | 30.000 | 10.000 | 10 |

| 3 | 700uH | 43 | 10 | 375 | 10.000 | 14.000 | 10 |

| 4 | 300uH | 20 | 1 | 45 | 20.000 | 17.000 | 100 |

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

4 rows in set (0.00 sec)

mysql> create table transistor(


PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII
->
t_id INT NOT NULL AUTO_INCREMENT,

-> t_name VARCHAR(20),

-> cost INT,

-> power FLOAT(5,3),

-> Ic FLOAT(5,3),

-> quantity INT,

-> PRIMARY KEY(t_id)

-> );

Query OK, 0 rows affected , 0 warnings(0.92 sec)

mysql> INSERT INTO transistor(t_name, cost, power, Ic, quantity ) VALUES

->(”BC530” , 38 , 0.625 , 40 , 0.1 , 100),

->(”BD140” , 40 , 12.5 , 10 , 1.5 , 100),

->(”BC556” , 40 , 0.5 , 125 , 0.1 , 100);

mysql> SELECT * FROM transistor;

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

| t_id | t_name | cost | power | Ic | quantity |

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

| 1 | BC530 | 38 | 0.625 | 0.100 | 100 |

| 2 | BD140 | 40 | 12.500 | 1.500 | 100 |

| 3 | BC556 | 40 | 0.500 | 0.100 | 100 |

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

3 rows in set (0.00 sec)

mysql> select order_id,order_no,quantity,(CASE

-> WHEN(r_id IS NOT NULL) THEN (SELECT cost FROM resistance WHERE
resistance.r_id=orders.r_id)
PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII
->
WHEN(c_id IS NOT NULL) THEN (SELECT cost FROM capacitors WHERE
capacitors.c_id=orders.c_id)

-> WHEN(t_id IS NOT NULL) THEN (SELECT cost FROM transistor WHERE
transistor.t_id=orders.t_id)

-> WHEN(i_id IS NOT NULL) THEN (SELECT cost FROM inductor WHERE
inductor.i_id=orders.i_id)

-> WHEN(ic_id IS NOT NULL) THEN (SELECT cost FROM ic WHERE ic.ic_id=orders.ic_id)

-> WHEN(d_id IS NOT NULL) THEN (SELECT cost FROM diode WHERE
diode.d_id=orders.d_id)

-> ELSE 1

-> END) as 'cost',

-> (CASE -> WHEN(r_id IS NOT NULL) THEN (SELECT r_name FROM resistance WHERE
resistance.r_id=orders.r_id)

-> WHEN(c_id IS NOT NULL) THEN (SELECT c_name FROM capacitors


WHEREcapacitors.c_id=orders.c_id)

-> WHEN(t_id IS NOT NULL) THEN (SELECT t_name FROM transistor


WHEREtransistor.t_id=orders.t_id)

-> WHEN(i_id IS NOT NULL) THEN (SELECT i_name FROM inductor WHERE
inductor.i_id=orders.i_id)

-> WHEN(d_id IS NOT NULL) THEN (SELECT d_name FROM diode WHERE
diode.d_id=orders.d_id)

-> WHEN(ic_id IS NOT NULL) THEN (SELECT ic_name FROM ic WHERE ic.ic_id=orders.ic_id)

-> ELSE NULL

-> END) as 'name',

-> (SELECT ('cost'*quantity)) as total

-> FROM orders WHERE order_no =1


PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII

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

| order_id | order_no | quantity | cost | name | total |

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

| 1 | 1 | 1 | 5.000 | 0.001uf | 5.000 |

| 2 | 1 | 1 | 5.000 | 0.01uf | 5.000 |

| 3 | 1 | 1 | 4.500 | 100uf | 4.500 |

| 4 | 1 | 4 | 0.410 | 5k ohm | 1.640 |

| 5 | 1 | 1 | 0.480 | 1.5k ohm | 0.480 |

| 6 | 1 | 1 | 0.320 | 50 ohm | 0.320 |

| 8 | 1 | 1 | 40.000 | BD140 | 40.000 |

| 9 | 1 | 1 | 5.000 | BC556 | 5.000 |

| 10 | 1 | 1 | 25.000 | LM358 | 25.000 |

+----------+----------+----------+--------+----------+-------+--------+-------------+
PUNE INSTITUTE OF COMPUTER TECHNOLOGY
PUNE - 411043
Department of Electronics & Telecommunication
ASSESMENT YEAR: 2018-2019 CLASS : SE V/VI/VII/VIII

You might also like