show databases; +--------------------+ | Database | +--------------------+ | information_schema | | fycsdemo1 | | fyds | | joins | | logindb | | logindb22 | | mysql | | performance_schema | | peru | | root | | sakila | | seema | | serve | | stud | | student | | students | | sycs | | test | | umar1 | | world | | yashzayn | +--------------------+ 21 rows in set (0.01 sec) mysql> use stud; Database changed mysql> show tables; +----------------+ | Tables_in_stud | +----------------+ | class | | student | +----------------+ 2 rows in set (0.00 sec) mysql> selct * from class; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'selct * from class' at line 1 mysql> select * from class; +-----+-------+----------+-------+--------+ | cid | cname | capacity | tfees | roomno | +-----+-------+----------+-------+--------+ | 110 | FYCS | 60 | 30089 | 605 | | 111 | FYIT | 120 | 33000 | 602 | | 112 | FYDS | 17 | 34300 | 605 | +-----+-------+----------+-------+--------+ 3 rows in set (0.01 sec) mysql> select * from student; +--------+------+-----+------------+---------+----------+------+ | ctrlno | name | rno | ct_no | address | paidfees | cid | +--------+------+-----+------------+---------+----------+------+ | 102 | EFC | 42 | 1234567890 | Chembur | 20000 | 111 | | 112 | ABC | 2 | 1234567890 | Chembur | 20000 | 110 | | 122 | ABC | 2 | 1234567890 | Chembur | 20000 | 111 | | 202 | EFC | 32 | 1234567890 | Chembur | 20000 | 112 | | 802 | RPC | 22 | 1234567890 | Chembur | 20000 | 112 | +--------+------+-----+------------+---------+----------+------+ 5 rows in set (0.01 sec) mysql> select cname from class; +-------+ | cname | +-------+ | FYCS | | FYIT | | FYDS | +-------+ 3 rows in set (0.00 sec) mysql> select cname,tfees from class; +-------+-------+ | cname | tfees | +-------+-------+ | FYCS | 30089 | | FYIT | 33000 | | FYDS | 34300 | +-------+-------+ 3 rows in set (0.00 sec) mysql> select * from class where cname='FYDS'; +-----+-------+----------+-------+--------+ | cid | cname | capacity | tfees | roomno | +-----+-------+----------+-------+--------+ | 112 | FYDS | 17 | 34300 | 605 | +-----+-------+----------+-------+--------+ 1 row in set (0.00 sec) mysql> select * from class where tfees>29000; +-----+-------+----------+-------+--------+ | cid | cname | capacity | tfees | roomno | +-----+-------+----------+-------+--------+ | 110 | FYCS | 60 | 30089 | 605 | | 111 | FYIT | 120 | 33000 | 602 | | 112 | FYDS | 17 | 34300 | 605 | +-----+-------+----------+-------+--------+ 3 rows in set (0.02 sec) mysql> select cname from class where tfees>29000; +-------+ | cname | +-------+ | FYCS | | FYIT | | FYDS | +-------+ 3 rows in set (0.00 sec) mysql> select cname from class where tfees>29000 and capacity>60; +-------+ | cname | +-------+ | FYIT | +-------+ 1 row in set (0.00 sec) mysql> select cname from class where tfees>30000 and capacity>60; +-------+ | cname | +-------+ | FYIT | +-------+ 1 row in set (0.00 sec) mysql> select cname from class where tfees>30000 or capacity>60; +-------+ | cname | +-------+ | FYCS | | FYIT | | FYDS | +-------+ 3 rows in set (0.00 sec) mysql> select cname from class where tfees>=30000 or capacity>60; +-------+ | cname | +-------+ | FYCS | | FYIT | | FYDS | +-------+ 3 rows in set (0.00 sec) mysql> select cname from class where tfees>=25000 and tfees<=28000; Empty set (0.00 sec) mysql> select cname from class where tfees between 25000 and 28000; Empty set (0.00 sec) mysql> select * from student where name like 'D%'; Empty set (0.00 sec) mysql> select * from student where name like 'D__'; Empty set (0.00 sec) mysql> select * from student where name like '__DS'; Empty set (0.00 sec) mysql> select * from student where cname like '__DS'; ERROR 1054 (42S22): Unknown column 'cname' in 'where clause' mysql> select * from class where cname like '__DS'; +-----+-------+----------+-------+--------+ | cid | cname | capacity | tfees | roomno | +-----+-------+----------+-------+--------+ | 112 | FYDS | 17 | 34300 | 605 | +-----+-------+----------+-------+--------+ 1 row in set (0.00 sec) mysql> select * from class where cname like 'FY__'; +-----+-------+----------+-------+--------+ | cid | cname | capacity | tfees | roomno | +-----+-------+----------+-------+--------+ | 110 | FYCS | 60 | 30089 | 605 | | 111 | FYIT | 120 | 33000 | 602 | | 112 | FYDS | 17 | 34300 | 605 | +-----+-------+----------+-------+--------+ 3 rows in set (0.00 sec) mysql> select * from class where roomno=605or roomno=604; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'roomno=604' at line 1 mysql> select * from class where roomno=605 or roomno=604; +-----+-------+----------+-------+--------+ | cid | cname | capacity | tfees | roomno | +-----+-------+----------+-------+--------+ | 110 | FYCS | 60 | 30089 | 605 | | 112 | FYDS | 17 | 34300 | 605 | +-----+-------+----------+-------+--------+ 2 rows in set (0.00 sec) mysql> select slect cname from class where roomno=605 or roomno=604; ERROR 1054 (42S22): Unknown column 'slect' in 'field list' mysql> select cname from class where roomno=605 or roomno=604; +-------+ | cname | +-------+ | FYCS | | FYDS | +-------+ 2 rows in set (0.00 sec) mysql> select cname from class where roomno in (605,604); +-------+ | cname | +-------+ | FYCS | | FYDS | +-------+ 2 rows in set (0.00 sec) mysql> select cname from class where roomno in (605,604,602,603); +-------+ | cname | +-------+ | FYCS | | FYIT | | FYDS | +-------+ 3 rows in set (0.00 sec) mysql> insert into class values (12, "SYDS",75, 28000,"NULL"); Query OK, 1 row affected (0.03 sec) mysql> select * from class; +-----+-------+----------+-------+--------+ | cid | cname | capacity | tfees | roomno | +-----+-------+----------+-------+--------+ | 12 | SYDS | 75 | 28000 | NULL | | 110 | FYCS | 60 | 30089 | 605 | | 111 | FYIT | 120 | 33000 | 602 | | 112 | FYDS | 17 | 34300 | 605 | +-----+-------+----------+-------+--------+ 4 rows in set (0.00 sec) mysql> select cname from class where roommo=NULL; ERROR 1054 (42S22): Unknown column 'roommo' in 'where clause' mysql> select cname from class where roomno=NULL; Empty set (0.01 sec) mysql> select cname from class where roomno is NULL; Empty set (0.00 sec)
To embed this program on your website, copy the following code and paste it into your website's HTML: