Book

Preview:

DESCRIPTION

mysql book

Citation preview

  • mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || test |+--------------------+2 rows in set (0.09 sec)

    mysql> use test;Database changedmysql> show tables;+----------------+| Tables_in_test |+----------------+| dept || emp |+----------------+2 rows in set (0.01 sec)

    mysql> select * from emp;+----+----------+--------+---------+| id | name | salary | dept_id |+----+----------+--------+---------+| 1 | sample | 25000 | 1 || 2 | ssafghhj | 20000 | 2 |+----+----------+--------+---------+2 rows in set (0.03 sec)

    mysql> select * from dept;+---------+-------------+| dept_id | dept_name |+---------+-------------+| 1 | Mathematics || 2 | Zoology || 3 | Botony |+---------+-------------+3 rows in set (0.00 sec)

    mysql> update emp set dept_id=3 where id='2';Query OK, 1 row affected (0.08 sec)Rows matched: 1 Changed: 1 Warnings: 0

    mysql> select * from dept;+---------+-------------+| dept_id | dept_name |+---------+-------------+| 1 | Mathematics || 2 | Zoology || 3 | Botony |+---------+-------------+3 rows in set (0.00 sec)

  • mysql> select * from emp;+----+----------+--------+---------+| id | name | salary | dept_id |+----+----------+--------+---------+| 1 | sample | 25000 | 1 || 2 | ssafghhj | 20000 | 3 |+----+----------+--------+---------+2 rows in set (0.00 sec)

    mysql> propmpt $ -> ;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds toyour MySQL server version for the right syntax to use near 'propmpt $' at line 1mysql> prompt $PROMPT set to '$'$select * from emp;+----+----------+--------+---------+| id | name | salary | dept_id |+----+----------+--------+---------+| 1 | sample | 25000 | 1 || 2 | ssafghhj | 20000 | 3 |+----+----------+--------+---------+2 rows in set (0.00 sec)

    $propmpt # -> ;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds toyour MySQL server version for the right syntax to use near 'propmpt' at line 1$prompt #PROMPT set to '#'#select * from emp;+----+----------+--------+---------+| id | name | salary | dept_id |+----+----------+--------+---------+| 1 | sample | 25000 | 1 || 2 | ssafghhj | 20000 | 3 |+----+----------+--------+---------+2 rows in set (0.00 sec)

    #exit

Recommended