0% found this document useful (0 votes)
5 views4 pages

NJ

The document is a transcript of a MySQL session, showcasing various commands and their outputs. It includes database operations such as selecting, inserting, and altering tables, along with error messages for incorrect SQL syntax. The session demonstrates the creation of a new table, insertion of data, and retrieval of information from existing tables.

Uploaded by

ns9512811
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

NJ

The document is a transcript of a MySQL session, showcasing various commands and their outputs. It includes database operations such as selecting, inserting, and altering tables, along with error messages for incorrect SQL syntax. The session demonstrates the creation of a new table, insertion of data, and retrieval of information from existing tables.

Uploaded by

ns9512811
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

Enter password: ****

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


Your MySQL connection id is 9
Server version: 8.3.0 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 11to12;


Database changed
mysql> show table;
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> show tables;
+------------------+
| Tables_in_11to12 |
+------------------+
| emp |
| type1 |
| type10 |
| type13 |
| type2 |
| type3 |
| type4 |
| type5 |
| type6 |
| type7 |
| type9 |
+------------------+
11 rows in set (0.01 sec)

mysql> show * from type1;


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 '* from
type1' at line 1
mysql> show * from type1;
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 '* from
type1' at line 1
mysql> show * from type2;
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 '* from
type2' at line 1
mysql> show * from emp;
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 '* from
emp' at line 1
mysql> select * from emp;
+-----+--------+------+-------+---------+
| eid | ename | exp | esal | edept |
+-----+--------+------+-------+---------+
| 90 | naveen | 0 | NULL | account |
| 100 | chinu | 5 | 20000 | coding |
| 101 | bhoul | 5 | 15000 | coding |
| 102 | millu | 5 | 15000 | coding |
| 104 | raghu | 5 | 10000 | coding |
| 112 | varun | 8 | 30000 | hr |
+-----+--------+------+-------+---------+
6 rows in set (0.00 sec)

mysql> create table autotest(eid int primarykey auto_increment,exp int);


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
'primarykey auto_increment,exp int)' at line 1
mysql> create table autotest(eid int primary key auto_increment,exp int);
Query OK, 0 rows affected (0.40 sec)

mysql> insert into autotest (exp)values(5);


Query OK, 1 row affected (0.08 sec)

mysql> select * from autotest;


+-----+------+
| eid | exp |
+-----+------+
| 1 | 5 |
+-----+------+
1 row in set (0.00 sec)

mysql> insert into autotest (exp) values (10);


Query OK, 1 row affected (0.11 sec)

mysql> select * from autotest;


+-----+------+
| eid | exp |
+-----+------+
| 1 | 5 |
| 2 | 10 |
+-----+------+
2 rows in set (0.00 sec)

mysql> insert into autotest (exp)values(3);


Query OK, 1 row affected (0.09 sec)

mysql> select * from autotest;


+-----+------+
| eid | exp |
+-----+------+
| 1 | 5 |
| 2 | 10 |
| 3 | 3 |
+-----+------+
3 rows in set (0.00 sec)

mysql> insert into autotest (exp) values (100,6);


ERROR 1136 (21S01): Column count doesn't match value count at row 1
mysql> insert into autotest (exp) values (100 6);
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 '6)' at
line 1
mysql> insert into autotest (exp) values (100)
-> ;
Query OK, 1 row affected (0.11 sec)
mysql> use 11to12;
Database changed
mysql> desc table;
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> desc emp;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| eid | int | NO | PRI | NULL | |
| ename | varchar(10) | YES | | NULL | |
| exp | int | YES | | NULL | |
| esal | float | YES | | NULL | |
| edept | varchar(10) | YES | | coding | |
+-------+-------------+------+-----+---------+-------+
5 rows in set (0.00 sec)

mysql> select * from emp;


+-----+--------+------+-------+---------+
| eid | ename | exp | esal | edept |
+-----+--------+------+-------+---------+
| 90 | naveen | 0 | NULL | account |
| 100 | chinu | 5 | 20000 | coding |
| 101 | bhoul | 5 | 15000 | coding |
| 102 | millu | 5 | 15000 | coding |
| 104 | raghu | 5 | 10000 | coding |
| 112 | varun | 8 | 30000 | hr |
+-----+--------+------+-------+---------+
6 rows in set (0.00 sec)

mysql> alter table emp modify column eid int auto_increment;


Query OK, 6 rows affected (1.34 sec)
Records: 6 Duplicates: 0 Warnings: 0

mysql> select * from emp;


+-----+--------+------+-------+---------+
| eid | ename | exp | esal | edept |
+-----+--------+------+-------+---------+
| 90 | naveen | 0 | NULL | account |
| 100 | chinu | 5 | 20000 | coding |
| 101 | bhoul | 5 | 15000 | coding |
| 102 | millu | 5 | 15000 | coding |
| 104 | raghu | 5 | 10000 | coding |
| 112 | varun | 8 | 30000 | hr |
+-----+--------+------+-------+---------+
6 rows in set (0.00 sec)

mysql> insert into emp (ename,exp,esal,edept) values('babu',8,50000,'gh');


Query OK, 1 row affected (0.09 sec)

mysql> select * from emp;


+-----+--------+------+-------+---------+
| eid | ename | exp | esal | edept |
+-----+--------+------+-------+---------+
| 90 | naveen | 0 | NULL | account |
| 100 | chinu | 5 | 20000 | coding |
| 101 | bhoul | 5 | 15000 | coding |
| 102 | millu | 5 | 15000 | coding |
| 104 | raghu | 5 | 10000 | coding |
| 112 | varun | 8 | 30000 | hr |
| 113 | babu | 8 | 50000 | gh |
+-----+--------+------+-------+---------+
7 rows in set (0.00 sec)

mysql> insert into emp (ename,exp,esal,edept) values('sabhu',6,40000,'ph');


Query OK, 1 row affected (0.41 sec)

mysql> select * from emp;


+-----+--------+------+-------+---------+
| eid | ename | exp | esal | edept |
+-----+--------+------+-------+---------+
| 90 | naveen | 0 | NULL | account |
| 100 | chinu | 5 | 20000 | coding |
| 101 | bhoul | 5 | 15000 | coding |
| 102 | millu | 5 | 15000 | coding |
| 104 | raghu | 5 | 10000 | coding |
| 112 | varun | 8 | 30000 | hr |
| 113 | babu | 8 | 50000 | gh |
| 114 | sabhu | 6 | 40000 | ph |
+-----+--------+------+-------+---------+
8 rows in set (0.00 sec)

mysql> select eid,esal from emp; -- it will show two column at top to end with each
row
+-----+-------+
| eid | esal |
+-----+-------+
| 90 | NULL |
| 100 | 20000 |
| 101 | 15000 |
| 102 | 15000 |
| 104 | 10000 |
| 112 | 30000 |
| 113 | 50000 |
| 114 | 40000 |
+-----+-------+
8 rows in set (0.00 sec)

mysql> select eid,esal /* it select 2 roe */ from emp;


+-----+-------+
| eid | esal |
+-----+-------+
| 90 | NULL |
| 100 | 20000 |
| 101 | 15000 |
| 102 | 15000 |
| 104 | 10000 |
| 112 | 30000 |
| 113 | 50000 |
| 114 | 40000 |
+-----+-------+
8 rows in set (0.00 sec)

mysql>

You might also like