Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 7

Microsoft Windows [Version 10.0.22631.

4460]
(c) Microsoft Corporation. All rights reserved.

C:\Users\RAFAT>mysql -u root -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 20
Server version: 8.0.40 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its


affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use rafat


Database changed
mysql> desc bookdetails;
+-----------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+-------------+------+-----+---------+-------+
| bookno | int | NO | PRI | NULL | |
| bookname | varchar(25) | YES | | NULL | |
| price | int | YES | | NULL | |
| publisher | varchar(25) | YES | | NULL | |
| dateofpublition | date | YES | | NULL | |
+-----------------+-------------+------+-----+---------+-------+
5 rows in set (0.07 sec)

mysql> select* from bookdetails;


+--------+-------------------+-------+--------------------+-----------------+
| bookno | bookname | price | publisher | dateofpublition |
+--------+-------------------+-------+--------------------+-----------------+
| 1 | MAHABHARAT | 500 | ZAHID | 2020-10-01 |
| 2 | RAMAYAN | 800 | MAHID | 2019-11-11 |
| 3 | LE PERE GARIOT | 100 | HONORE DE BELZAC | 1835-11-11 |
| 4 | DAVID COPPERFIELD | 1100 | CHARLES DICKENS | 1849-12-11 |
| 5 | WAR AND PEACE | 1500 | TOLSTOY | 1869-09-08 |
| 6 | HULULU | 1100 | BOWMAN | 1870-09-08 |
| 7 | LALLAA | 1170 | SHAKTIMAN | 1876-01-08 |
| 8 | KOHRE KOHRE SAPNE | 1220 | BHANU PRATAP SINGH | 1896-01-02 |
| 9 | SIGMA | 2230 | THOMAS SHELBY | 1796-07-05 |
| 10 | SITUATIONSHIP | 2110 | SAMAY | 1996-02-01 |
+--------+-------------------+-------+--------------------+-----------------+
10 rows in set (0.00 sec)

mysql> select bookno,bookname,ABS(price) as "ABSOLUTE FUNCTION" from bookdetails;


+--------+-------------------+-------------------+
| bookno | bookname | ABSOLUTE FUNCTION |
+--------+-------------------+-------------------+
| 1 | MAHABHARAT | 500 |
| 2 | RAMAYAN | 800 |
| 3 | LE PERE GARIOT | 100 |
| 4 | DAVID COPPERFIELD | 1100 |
| 5 | WAR AND PEACE | 1500 |
| 6 | HULULU | 1100 |
| 7 | LALLAA | 1170 |
| 8 | KOHRE KOHRE SAPNE | 1220 |
| 9 | SIGMA | 2230 |
| 10 | SITUATIONSHIP | 2110 |
+--------+-------------------+-------------------+
10 rows in set (0.00 sec)

mysql> select bookno,bookname,MOD(price,2) as "MOD FUNCTION" from bookdetails;


+--------+-------------------+--------------+
| bookno | bookname | MOD FUNCTION |
+--------+-------------------+--------------+
| 1 | MAHABHARAT | 0 |
| 2 | RAMAYAN | 0 |
| 3 | LE PERE GARIOT | 0 |
| 4 | DAVID COPPERFIELD | 0 |
| 5 | WAR AND PEACE | 0 |
| 6 | HULULU | 0 |
| 7 | LALLAA | 0 |
| 8 | KOHRE KOHRE SAPNE | 0 |
| 9 | SIGMA | 0 |
| 10 | SITUATIONSHIP | 0 |
+--------+-------------------+--------------+
10 rows in set (0.00 sec)

mysql> select bookno,bookname,POW(price,2) as "POWER FUNCTION" from bookdetails;


+--------+-------------------+----------------+
| bookno | bookname | POWER FUNCTION |
+--------+-------------------+----------------+
| 1 | MAHABHARAT | 250000 |
| 2 | RAMAYAN | 640000 |
| 3 | LE PERE GARIOT | 10000 |
| 4 | DAVID COPPERFIELD | 1210000 |
| 5 | WAR AND PEACE | 2250000 |
| 6 | HULULU | 1210000 |
| 7 | LALLAA | 1368900 |
| 8 | KOHRE KOHRE SAPNE | 1488400 |
| 9 | SIGMA | 4972900 |
| 10 | SITUATIONSHIP | 4452100 |
+--------+-------------------+----------------+
10 rows in set (0.00 sec)

mysql> select bookno,bookname,publisher,SQRT(bookno) as "SQRT FUNCTION" from


bookdetails;
+--------+-------------------+--------------------+--------------------+
| bookno | bookname | publisher | SQRT FUNCTION |
+--------+-------------------+--------------------+--------------------+
| 1 | MAHABHARAT | ZAHID | 1 |
| 2 | RAMAYAN | MAHID | 1.4142135623730951 |
| 3 | LE PERE GARIOT | HONORE DE BELZAC | 1.7320508075688772 |
| 4 | DAVID COPPERFIELD | CHARLES DICKENS | 2 |
| 5 | WAR AND PEACE | TOLSTOY | 2.23606797749979 |
| 6 | HULULU | BOWMAN | 2.449489742783178 |
| 7 | LALLAA | SHAKTIMAN | 2.6457513110645907 |
| 8 | KOHRE KOHRE SAPNE | BHANU PRATAP SINGH | 2.8284271247461903 |
| 9 | SIGMA | THOMAS SHELBY | 3 |
| 10 | SITUATIONSHIP | SAMAY | 3.1622776601683795 |
+--------+-------------------+--------------------+--------------------+
10 rows in set (0.00 sec)

mysql> select ROUND(3478.649),ROUND(3478.649,0),ROUND(40.62,-1);


+-----------------+-------------------+-----------------+
| ROUND(3478.649) | ROUND(3478.649,0) | ROUND(40.62,-1) |
+-----------------+-------------------+-----------------+
| 3479 | 3479 | 40 |
+-----------------+-------------------+-----------------+
1 row in set (0.00 sec)

mysql> select TRUNCATE(27.59,1),TRUNCATE(389.23,-2),TRUNCATE(345.678,2);


+-------------------+---------------------+---------------------+
| TRUNCATE(27.59,1) | TRUNCATE(389.23,-2) | TRUNCATE(345.678,2) |
+-------------------+---------------------+---------------------+
| 27.5 | 300 | 345.67 |
+-------------------+---------------------+---------------------+
1 row in set (0.00 sec)

mysql> select* from bikes;


ERROR 1146 (42S02): Table 'rafat.bikes' doesn't exist
mysql> select* from bookdetails;
+--------+-------------------+-------+--------------------+-----------------+
| bookno | bookname | price | publisher | dateofpublition |
+--------+-------------------+-------+--------------------+-----------------+
| 1 | MAHABHARAT | 500 | ZAHID | 2020-10-01 |
| 2 | RAMAYAN | 800 | MAHID | 2019-11-11 |
| 3 | LE PERE GARIOT | 100 | HONORE DE BELZAC | 1835-11-11 |
| 4 | DAVID COPPERFIELD | 1100 | CHARLES DICKENS | 1849-12-11 |
| 5 | WAR AND PEACE | 1500 | TOLSTOY | 1869-09-08 |
| 6 | HULULU | 1100 | BOWMAN | 1870-09-08 |
| 7 | LALLAA | 1170 | SHAKTIMAN | 1876-01-08 |
| 8 | KOHRE KOHRE SAPNE | 1220 | BHANU PRATAP SINGH | 1896-01-02 |
| 9 | SIGMA | 2230 | THOMAS SHELBY | 1796-07-05 |
| 10 | SITUATIONSHIP | 2110 | SAMAY | 1996-02-01 |
+--------+-------------------+-------+--------------------+-----------------+
10 rows in set (0.00 sec)

mysql> select bookno,bookname,lower(bookname) as "Lower Function" from bookdetails;


+--------+-------------------+-------------------+
| bookno | bookname | Lower Function |
+--------+-------------------+-------------------+
| 1 | MAHABHARAT | mahabharat |
| 2 | RAMAYAN | ramayan |
| 3 | LE PERE GARIOT | le pere gariot |
| 4 | DAVID COPPERFIELD | david copperfield |
| 5 | WAR AND PEACE | war and peace |
| 6 | HULULU | hululu |
| 7 | LALLAA | lallaa |
| 8 | KOHRE KOHRE SAPNE | kohre kohre sapne |
| 9 | SIGMA | sigma |
| 10 | SITUATIONSHIP | situationship |
+--------+-------------------+-------------------+
10 rows in set (0.00 sec)

mysql> select bookno,bookname,upper(bookname) as "Upper Function" from bookdetails;


+--------+-------------------+-------------------+
| bookno | bookname | Upper Function |
+--------+-------------------+-------------------+
| 1 | MAHABHARAT | MAHABHARAT |
| 2 | RAMAYAN | RAMAYAN |
| 3 | LE PERE GARIOT | LE PERE GARIOT |
| 4 | DAVID COPPERFIELD | DAVID COPPERFIELD |
| 5 | WAR AND PEACE | WAR AND PEACE |
| 6 | HULULU | HULULU |
| 7 | LALLAA | LALLAA |
| 8 | KOHRE KOHRE SAPNE | KOHRE KOHRE SAPNE |
| 9 | SIGMA | SIGMA |
| 10 | SITUATIONSHIP | SITUATIONSHIP |
+--------+-------------------+-------------------+
10 rows in set (0.00 sec)

mysql> select bookno,bookname,LENGTH(bookname) as "Length Function" from


bookdetails;
+--------+-------------------+-----------------+
| bookno | bookname | Length Function |
+--------+-------------------+-----------------+
| 1 | MAHABHARAT | 10 |
| 2 | RAMAYAN | 7 |
| 3 | LE PERE GARIOT | 14 |
| 4 | DAVID COPPERFIELD | 17 |
| 5 | WAR AND PEACE | 13 |
| 6 | HULULU | 6 |
| 7 | LALLAA | 6 |
| 8 | KOHRE KOHRE SAPNE | 17 |
| 9 | SIGMA | 5 |
| 10 | SITUATIONSHIP | 13 |
+--------+-------------------+-----------------+
10 rows in set (0.00 sec)

mysql> select bookno,bookname,instr(bookname,"i") as "Instr Function" from


bookdetails;
+--------+-------------------+----------------+
| bookno | bookname | Instr Function |
+--------+-------------------+----------------+
| 1 | MAHABHARAT | 0 |
| 2 | RAMAYAN | 0 |
| 3 | LE PERE GARIOT | 12 |
| 4 | DAVID COPPERFIELD | 4 |
| 5 | WAR AND PEACE | 0 |
| 6 | HULULU | 0 |
| 7 | LALLAA | 0 |
| 8 | KOHRE KOHRE SAPNE | 0 |
| 9 | SIGMA | 2 |
| 10 | SITUATIONSHIP | 2 |
+--------+-------------------+----------------+
10 rows in set (0.00 sec)

mysql> select bookno,bookname,substr(bookname,5) as "Substr Function" from


bookdetails;
+--------+-------------------+-----------------+
| bookno | bookname | Substr Function |
+--------+-------------------+-----------------+
| 1 | MAHABHARAT | BHARAT |
| 2 | RAMAYAN | YAN |
| 3 | LE PERE GARIOT | ERE GARIOT |
| 4 | DAVID COPPERFIELD | D COPPERFIELD |
| 5 | WAR AND PEACE | AND PEACE |
| 6 | HULULU | LU |
| 7 | LALLAA | AA |
| 8 | KOHRE KOHRE SAPNE | E KOHRE SAPNE |
| 9 | SIGMA | A |
| 10 | SITUATIONSHIP | ATIONSHIP |
+--------+-------------------+-----------------+
10 rows in set (0.00 sec)

mysql> select bookno,bookname,left(bookname,5) as "Left Function" from bookdetails;


+--------+-------------------+---------------+
| bookno | bookname | Left Function |
+--------+-------------------+---------------+
| 1 | MAHABHARAT | MAHAB |
| 2 | RAMAYAN | RAMAY |
| 3 | LE PERE GARIOT | LE PE |
| 4 | DAVID COPPERFIELD | DAVID |
| 5 | WAR AND PEACE | WAR A |
| 6 | HULULU | HULUL |
| 7 | LALLAA | LALLA |
| 8 | KOHRE KOHRE SAPNE | KOHRE |
| 9 | SIGMA | SIGMA |
| 10 | SITUATIONSHIP | SITUA |
+--------+-------------------+---------------+
10 rows in set (0.00 sec)

mysql> select bookno,bookname,right(bookname,5) as "Right Function" from


bookdetails;
+--------+-------------------+----------------+
| bookno | bookname | Right Function |
+--------+-------------------+----------------+
| 1 | MAHABHARAT | HARAT |
| 2 | RAMAYAN | MAYAN |
| 3 | LE PERE GARIOT | ARIOT |
| 4 | DAVID COPPERFIELD | FIELD |
| 5 | WAR AND PEACE | PEACE |
| 6 | HULULU | ULULU |
| 7 | LALLAA | ALLAA |
| 8 | KOHRE KOHRE SAPNE | SAPNE |
| 9 | SIGMA | SIGMA |
| 10 | SITUATIONSHIP | NSHIP |
+--------+-------------------+----------------+
10 rows in set (0.00 sec)

mysql> select bookno,bookname,mid(bookname,2,4) as "Mid Function" from bookdetails;


+--------+-------------------+--------------+
| bookno | bookname | Mid Function |
+--------+-------------------+--------------+
| 1 | MAHABHARAT | AHAB |
| 2 | RAMAYAN | AMAY |
| 3 | LE PERE GARIOT | E PE |
| 4 | DAVID COPPERFIELD | AVID |
| 5 | WAR AND PEACE | AR A |
| 6 | HULULU | ULUL |
| 7 | LALLAA | ALLA |
| 8 | KOHRE KOHRE SAPNE | OHRE |
| 9 | SIGMA | IGMA |
| 10 | SITUATIONSHIP | ITUA |
+--------+-------------------+--------------+
10 rows in set (0.00 sec)

mysql> select curdate();


+------------+
| curdate() |
+------------+
| 2024-12-16 |
+------------+
1 row in set (0.00 sec)

mysql> select sysdate();


+---------------------+
| sysdate() |
+---------------------+
| 2024-12-16 16:41:42 |
+---------------------+
1 row in set (0.00 sec)

mysql> select now();


+---------------------+
| now() |
+---------------------+
| 2024-12-16 16:42:09 |
+---------------------+
1 row in set (0.00 sec)

mysql> select bookno,bookname,dateofpublition,year(dateofpublition)from


bookdetails;
+--------+-------------------+-----------------+-----------------------+
| bookno | bookname | dateofpublition | year(dateofpublition) |
+--------+-------------------+-----------------+-----------------------+
| 1 | MAHABHARAT | 2020-10-01 | 2020 |
| 2 | RAMAYAN | 2019-11-11 | 2019 |
| 3 | LE PERE GARIOT | 1835-11-11 | 1835 |
| 4 | DAVID COPPERFIELD | 1849-12-11 | 1849 |
| 5 | WAR AND PEACE | 1869-09-08 | 1869 |
| 6 | HULULU | 1870-09-08 | 1870 |
| 7 | LALLAA | 1876-01-08 | 1876 |
| 8 | KOHRE KOHRE SAPNE | 1896-01-02 | 1896 |
| 9 | SIGMA | 1796-07-05 | 1796 |
| 10 | SITUATIONSHIP | 1996-02-01 | 1996 |
+--------+-------------------+-----------------+-----------------------+
10 rows in set (0.00 sec)

mysql> select bookno,bookname,dateofpublition,month(dateofpublition)from


bookdetails;
+--------+-------------------+-----------------+------------------------+
| bookno | bookname | dateofpublition | month(dateofpublition) |
+--------+-------------------+-----------------+------------------------+
| 1 | MAHABHARAT | 2020-10-01 | 10 |
| 2 | RAMAYAN | 2019-11-11 | 11 |
| 3 | LE PERE GARIOT | 1835-11-11 | 11 |
| 4 | DAVID COPPERFIELD | 1849-12-11 | 12 |
| 5 | WAR AND PEACE | 1869-09-08 | 9 |
| 6 | HULULU | 1870-09-08 | 9 |
| 7 | LALLAA | 1876-01-08 | 1 |
| 8 | KOHRE KOHRE SAPNE | 1896-01-02 | 1 |
| 9 | SIGMA | 1796-07-05 | 7 |
| 10 | SITUATIONSHIP | 1996-02-01 | 2 |
+--------+-------------------+-----------------+------------------------+
10 rows in set (0.00 sec)

mysql> select bookno,bookname,dateofpublition,dayname(dateofpublition)from


bookdetails;
+--------+-------------------+-----------------+--------------------------+
| bookno | bookname | dateofpublition | dayname(dateofpublition) |
+--------+-------------------+-----------------+--------------------------+
| 1 | MAHABHARAT | 2020-10-01 | Thursday |
| 2 | RAMAYAN | 2019-11-11 | Monday |
| 3 | LE PERE GARIOT | 1835-11-11 | Wednesday |
| 4 | DAVID COPPERFIELD | 1849-12-11 | Tuesday |
| 5 | WAR AND PEACE | 1869-09-08 | Wednesday |
| 6 | HULULU | 1870-09-08 | Thursday |
| 7 | LALLAA | 1876-01-08 | Saturday |
| 8 | KOHRE KOHRE SAPNE | 1896-01-02 | Thursday |
| 9 | SIGMA | 1796-07-05 | Tuesday |
| 10 | SITUATIONSHIP | 1996-02-01 | Thursday |
+--------+-------------------+-----------------+--------------------------+
10 rows in set (0.01 sec)

mysql> select bookno,bookname,dateofpublition,monthname(dateofpublition)from


bookdetails;
+--------+-------------------+-----------------+----------------------------+
| bookno | bookname | dateofpublition | monthname(dateofpublition) |
+--------+-------------------+-----------------+----------------------------+
| 1 | MAHABHARAT | 2020-10-01 | October |
| 2 | RAMAYAN | 2019-11-11 | November |
| 3 | LE PERE GARIOT | 1835-11-11 | November |
| 4 | DAVID COPPERFIELD | 1849-12-11 | December |
| 5 | WAR AND PEACE | 1869-09-08 | September |
| 6 | HULULU | 1870-09-08 | September |
| 7 | LALLAA | 1876-01-08 | January |
| 8 | KOHRE KOHRE SAPNE | 1896-01-02 | January |
| 9 | SIGMA | 1796-07-05 | July |
| 10 | SITUATIONSHIP | 1996-02-01 | February |
+--------+-------------------+-----------------+----------------------------+
10 rows in set (0.00 sec)

mysql> select
bookno,bookname,dateofpublition,CONCAT(DAY(dateofpublition),",",MONTHNAME(dateofpub
lition),",",YEAR(dateofpublition)) as "Starting Date"from b
ookdetails;
+--------+-------------------+-----------------+------------------+
| bookno | bookname | dateofpublition | Starting Date |
+--------+-------------------+-----------------+------------------+
| 1 | MAHABHARAT | 2020-10-01 | 1,October,2020 |
| 2 | RAMAYAN | 2019-11-11 | 11,November,2019 |
| 3 | LE PERE GARIOT | 1835-11-11 | 11,November,1835 |
| 4 | DAVID COPPERFIELD | 1849-12-11 | 11,December,1849 |
| 5 | WAR AND PEACE | 1869-09-08 | 8,September,1869 |
| 6 | HULULU | 1870-09-08 | 8,September,1870 |
| 7 | LALLAA | 1876-01-08 | 8,January,1876 |
| 8 | KOHRE KOHRE SAPNE | 1896-01-02 | 2,January,1896 |
| 9 | SIGMA | 1796-07-05 | 5,July,1796 |
| 10 | SITUATIONSHIP | 1996-02-01 | 1,February,1996 |
+--------+-------------------+-----------------+------------------+
10 rows in set (0.00 sec)

mysql>

You might also like