0% found this document useful (0 votes)
21 views2 pages

18-07-23 Mysql (IP)

Sql
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)
21 views2 pages

18-07-23 Mysql (IP)

Sql
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/ 2

mysql> create database librarydetails1;

Query OK, 1 row affected (0.01 sec)

mysql> use librarydetails1;


Database changed
mysql> create table librarydetailsschool
-> (bookno integer ,
-> bookname varchar(20),
-> authorname varchar(20),
-> price decimal(6,2));
Query OK, 0 rows affected (0.01 sec)
mysql> insert into librarydetailsschool
-> values(1,'harry potter ','j.k rowling',500.00);
Query OK, 1 row affected (0.00 sec)
mysql> insert into librarydetailsschool
-> values(2,'informatic practices','sunita arora',400.00);
Query OK, 1 row affected (0.00 sec)
mysql> insert into librarydetailsschool
-> values(1,'hardy boys ','franklin w.dixon',500.00);
Query OK, 1 row affected (0.00 sec)
mysql> insert into librarydetailsschool
-> values(4,'utopia ','charles ',600.00);
Query OK, 1 row affected (0.00 sec)
mysql> insert into librarydetailsschool
-> values(5,'feluda ','satyajit ray',800.00);
Query OK, 1 row affected (0.00 sec)
mysql> select *from librarydetailsschool;
+--------+----------------------+------------------+--------+
| bookno | bookname | authorname | price |
+--------+----------------------+------------------+--------+
| 1 | harry potter | j.k rowling | 500.00 |
| 2 | informatic practices | sunita arora | 400.00 |
| 1 | hardy boys | franklin w.dixon | 500.00 |
| 4 | utopia | charles | 600.00 |
| 5 | feluda | satyajit ray | 800.00 |
+--------+----------------------+------------------+--------+
5 rows in set (0.00 sec)
mysql> select bookname , price *2 as price from librarydetailsschool;
+----------------------+---------+
| bookname | price |
+----------------------+---------+
| harry potter | 1000.00 |
| informatic practices | 800.00 |
| hardy boys | 1000.00 |
| utopia | 1200.00 |
| feluda | 1600.00 |
+----------------------+---------+
5 rows in set (0.00 sec)
mysql> select bookname , price -200 as price from librarydetailsschool;
+----------------------+--------+
| bookname | price |
+----------------------+--------+
| harry potter | 300.00 |
| informatic practices | 200.00 |
| hardy boys | 300.00 |
| utopia | 400.00 |
| feluda | 600.00 |
+----------------------+--------+
5 rows in set (0.00 sec)
mysql> select bookname , price +200 as price from librarydetailsschool;
+----------------------+---------+
| bookname | price |
+----------------------+---------+
| harry potter | 700.00 |
| informatic practices | 600.00 |
| hardy boys | 700.00 |
| utopia | 800.00 |
| feluda | 1000.00 |
+----------------------+---------+
5 rows in set (0.00 sec)
mysql> select bookname , price /2 as price from librarydetailsschool;
+----------------------+------------+
| bookname | price |
+----------------------+------------+
| harry potter | 250.000000 |
| informatic practices | 200.000000 |
| hardy boys | 250.000000 |
| utopia | 300.000000 |
| feluda | 400.000000 |
+----------------------+------------+
5 rows in set (0.00 sec)

You might also like