You are on page 1of 4

Enter password:

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


Your MySQL connection id is 2
Server version: 5.0.45-community-nt MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use fulltime;
ERROR 1049 (42000): Unknown database 'fulltime'
mysql> use database fulltime;
ERROR 1049 (42000): Unknown database 'database'
mysql> create database employee;
ERROR 1007 (HY000): Can't create database 'employee'; database exists
mysql> use database fulltime;
ERROR 1049 (42000): Unknown database 'database'
mysql> use fulltime;
ERROR 1049 (42000): Unknown database 'fulltime'
mysql> describe fulltime;
ERROR 1046 (3D000): No database selected
mysql> create table fulltime(
-> id int,name varchar(20), sex char,
-> position varchar(20),
-> department varchar(20),
-> address varchar(20);
ERROR 1046 (3D000): No database selected
mysql> use employee;
Database changed
mysql> describe fulltime;
+------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | varchar(20) | YES | | NULL | |
| sex | char(1) | YES | | NULL | |
| position | varchar(20) | YES | | NULL | |
| department | varchar(20) | YES | | NULL | |
| address | varchar(30) | YES | | NULL | |
+------------+-------------+------+-----+---------+-------+
6 rows in set (0.00 sec)
mysql> select * from fulltime;
+------+--------+------+------------+------------+---------------+
| id | name | sex | position | department | address |
+------+--------+------+------------+------------+---------------+
| 100 | Jhune | m | clerk | HR | San Jose City |
| 101 | Jhuner | m | staff | HR | San Isidro |
| 102 | Jhames | m | staff | accounting | San Juan |
| 103 | Sarah | f | instructor | faculty | Rizal |
| 104 | Shane | f | utility | HR | Magsaysay |
| 105 | Julian | m | utility | HR | Munoz |
+------+--------+------+------------+------------+---------------+
6 rows in set (0.00 sec)
mysql> insert into fulltime(id,name,sex,position,department,address)
-> values(106,"julie",'f',"instructor","faculty","talavera");
Query OK, 1 row affected (0.03 sec)
mysql> insert into fulltime(id,name,sex,position,department,address)
-> values(107,"Bryan",'m',"dean","accounting","Cabanatuan");
Query OK, 1 row affected (0.39 sec)
mysql> select * from fulltime;
+------+--------+------+------------+------------+---------------+
| id | name | sex | position | department | address |
+------+--------+------+------------+------------+---------------+
| 100 | Jhune | m | clerk | HR | San Jose City |
| 101 | Jhuner | m | staff | HR | San Isidro |
| 102 | Jhames | m | staff | accounting | San Juan |
| 103 | Sarah | f | instructor | faculty | Rizal |
| 104 | Shane | f | utility | HR | Magsaysay |
| 105 | Julian | m | utility | HR | Munoz |
| 106 | julie | f | instructor | faculty | talavera |
| 107 | Bryan | m | dean | accounting | Cabanatuan |
+------+--------+------+------------+------------+---------------+
8 rows in set (0.00 sec)
mysql> select * from fulltime where sex='m' and address="San Jose City";
+------+-------+------+----------+------------+---------------+
| id | name | sex | position | department | address |
+------+-------+------+----------+------------+---------------+
| 100 | Jhune | m | clerk | HR | San Jose City |
+------+-------+------+----------+------------+---------------+
1 row in set (0.03 sec)
mysql> select * from fulltime where sex='m' and position="staff" or sex='f' and
position="utility" or sex='m' and position="instructor";
+------+--------+------+----------+------------+------------+
| id | name | sex | position | department | address |
+------+--------+------+----------+------------+------------+
| 101 | Jhuner | m | staff | HR | San Isidro |
| 102 | Jhames | m | staff | accounting | San Juan |
| 104 | Shane | f | utility | HR | Magsaysay |
+------+--------+------+----------+------------+------------+
3 rows in set (0.00 sec)
mysql> update fulltime set address="cabanatuan", department="finance" where sex=
'm' and position="dean" OR position="staff" and id=101;
Query OK, 2 rows affected (0.08 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> select * from fulltime;
+------+--------+------+------------+------------+---------------+
| id | name | sex | position | department | address |
+------+--------+------+------------+------------+---------------+
| 100 | Jhune | m | clerk | HR | San Jose City |
| 101 | Jhuner | m | staff | finance | cabanatuan |
| 102 | Jhames | m | staff | accounting | San Juan |
| 103 | Sarah | f | instructor | faculty | Rizal |
| 104 | Shane | f | utility | HR | Magsaysay |
| 105 | Julian | m | utility | HR | Munoz |
| 106 | julie | f | instructor | faculty | talavera |
| 107 | Bryan | m | dean | finance | cabanatuan |
+------+--------+------+------------+------------+---------------+
8 rows in set (0.00 sec)
mysql> select * from fulltime where name LIKE J%;
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 '%' at
line 1
mysql> select * from fulltime where name LIkE(J%);
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 ')' at
line 1
mysql> select * from fulltime where name like (J%);
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 ')' at
line 1
mysql> select * from fulltime where name like "j%");
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 ')' at
line 1
mysql> select * from fulltime where name like "J%");
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 ')' at
line 1
mysql> select * from fulltime where name like 'J%');
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 ')' at
line 1
mysql> select * from fulltime where name like 'j%';
+------+--------+------+------------+------------+---------------+
| id | name | sex | position | department | address |
+------+--------+------+------------+------------+---------------+
| 100 | Jhune | m | clerk | HR | San Jose City |
| 101 | Jhuner | m | staff | finance | cabanatuan |
| 102 | Jhames | m | staff | accounting | San Juan |
| 105 | Julian | m | utility | HR | Munoz |
| 106 | julie | f | instructor | faculty | talavera |
+------+--------+------+------------+------------+---------------+
5 rows in set (0.00 sec)
mysql> select * from fulltime where name like '%a%';
+------+--------+------+------------+------------+------------+
| id | name | sex | position | department | address |
+------+--------+------+------------+------------+------------+
| 102 | Jhames | m | staff | accounting | San Juan |
| 103 | Sarah | f | instructor | faculty | Rizal |
| 104 | Shane | f | utility | HR | Magsaysay |
| 105 | Julian | m | utility | HR | Munoz |
| 107 | Bryan | m | dean | finance | cabanatuan |
+------+--------+------+------------+------------+------------+
5 rows in set (0.00 sec)
mysql> select * from fulltime where name like 'j____';
+------+-------+------+------------+------------+---------------+
| id | name | sex | position | department | address |
+------+-------+------+------------+------------+---------------+
| 100 | Jhune | m | clerk | HR | San Jose City |
| 106 | julie | f | instructor | faculty | talavera |
+------+-------+------+------------+------------+---------------+
2 rows in set (0.00 sec)
mysql> select id, name, sex from fulltime position="staff" address like '%city'
and address like 's%';
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 '="sta
ff" address like '%city' and address like 's%'' at line 1
mysql> select id, name, sex from fulltime where position="staff" address like '%
city' and address like 's%';
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 'addre
ss like '%city' and address like 's%'' at line 1
mysql> select id, name, sex from fulltime position="staff" and address like 's%'
;
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 '="sta
ff" and address like 's%'' at line 1
mysql> select id, name, sex from fulltime position="staff" and address like 's%'
;
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 '="sta
ff" and address like 's%'' at line 1
mysql> select id,name,sex from fulltime where position="staff" and adress like '
%city' and adress like 's%';
ERROR 1054 (42S22): Unknown column 'adress' in 'where clause'
mysql> select id,name,sex from fulltime where position="staff" and adress like '
%city' and address like 's%';
ERROR 1054 (42S22): Unknown column 'adress' in 'where clause'
mysql> select id,name,sex from fulltime where position="staff" and adress like '
%city' and address like 's%';
ERROR 1054 (42S22): Unknown column 'adress' in 'where clause'
mysql> select id,name,sex from fulltime where position="staff" and address like
'%city' and address like 's%';
Empty set (0.02 sec)
mysql> select id,name,sex from fulltime where position="staff" and address like
'%city' and address like 's%';
Empty set (0.00 sec)
mysql> select id,name,sex from fulltime where position="staff" and address like
's%';
+------+--------+------+
| id | name | sex |
+------+--------+------+
| 102 | Jhames | m |
+------+--------+------+
1 row in set (0.00 sec)
mysql>

You might also like