Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
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;
ERROR:
USE must be followed by a database name
mysql> use 11to12;
Database changed
mysql> create tale btech(roll no int, name varchar,age 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 'tale
btech(roll no int, name varchar,age int
)' at line 1
mysql> create table btech(roll no int, name varchar,age 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 'no int,
name varchar,age int
)' at line 1
mysql> create table btech(roll_no int, name varchar,age 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 ',age int
)' at line 1
mysql> create table btech(roll_no int, name varchar,age 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 ',age
int)' at line 1
mysql> create table btech(roll_no int, name varchar(20),age int);
Query OK, 0 rows affected (0.89 sec)
mysql> create table mba(roll_no int, name varchar(20),age int);
Query OK, 0 rows affected (0.85 sec)
mysql> create table mba(roll_no int, name varchar(20),age int);
ERROR 1050 (42S01): Table 'mba' already exists
mysql> insert into mba(1,'b'3),(2,'c',4),(3,'f',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 '1,'b'3),
(2,'c',4),(3,'f',6)' at line 1
mysql> insert into mba values (1,'b'3),(2,'c',4),(3,'f',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 '3),
(2,'c',4),(3,'f',6)' at line 1
mysql> insert into mba values (1,'b',3),(2,'c',4),(3,'f',6);
Query OK, 3 rows affected (0.13 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> insert into btch values (5,'f',3),(8,'c',4),(55,'f',6);
ERROR 1146 (42S02): Table '[Link]' doesn't exist
mysql> insert into btech values (5,'f',3),(8,'c',4),(55,'f',6);
Query OK, 3 rows affected (0.09 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> select * from betch union select * from mba;
ERROR 1146 (42S02): Table '[Link]' doesn't exist
mysql> select * from btech union select * from mba;
+---------+------+------+
| roll_no | name | age |
+---------+------+------+
| 5 | f | 3 |
| 8 | c | 4 |
| 55 | f | 6 |
| 1 | b | 3 |
| 2 | c | 4 |
| 3 | f | 6 |
+---------+------+------+
6 rows in set (0.00 sec)
mysql> select * mba;
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 'mba' at
line 1
mysql> select * from mba;
+---------+------+------+
| roll_no | name | age |
+---------+------+------+
| 1 | b | 3 |
| 2 | c | 4 |
| 3 | f | 6 |
+---------+------+------+
3 rows in set (0.00 sec)
mysql> select * from btech;
+---------+------+------+
| roll_no | name | age |
+---------+------+------+
| 5 | f | 3 |
| 8 | c | 4 |
| 55 | f | 6 |
+---------+------+------+
3 rows in set (0.00 sec)
mysql> drop table betch;
ERROR 1051 (42S02): Unknown table '[Link]'
mysql> drop table btech;
Query OK, 0 rows affected (0.92 sec)
mysql> drop table mba;
Query OK, 0 rows affected (0.87 sec)
mysql> create table MBA (roll_no,int),(name,varchar(10),(age , 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 ',int),
(name,varchar(10),(age , int)' at line 1
mysql> create table MBA (roll_no int),(name,varchar(10),(age , 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 ',
(name,varchar(10),(age , int)' at line 1
mysql> create table MBA (roll_no int),(name,varchar(10),(age , 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 ',
(name,varchar(10),(age , int)' at line 1
mysql> create table MBA (roll_no int ,name varchar(10 ,age , 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 ',age ,
int)' at line 1
mysql> create table MBA (roll_no int ,name varchar(10 ,age 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 ',age
int)' at line 1
mysql> create table MBA (roll_no int ,name varchar(10) ,age int);
Query OK, 0 rows affected (0.39 sec)
mysql> create table BETCH (roll_no int ,name varchar(10) ,age int);
Query OK, 0 rows affected (0.48 sec)
mysql> insert into mba (1,'Arun',20),(2,'saurabh'15)(3,'babau',20);
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
'1,'Arun',20),(2,'saurabh'15)(3,'babau',20)' at line 1
mysql> insert into mba values (1,'Arun',20),(2,'saurabh'15)(3,'babau',20);
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 '15)
(3,'babau',20)' at line 1
mysql> insert into mba values (1,'Arun',20),(2,'saurabh',15)(3,'babau',20);
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
'(3,'babau',20)' at line 1
mysql> insert into mba values (1,'Arun',20),(2,'saurabh',15)(3,'babau',20);
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
'(3,'babau',20)' at line 1
mysql> insert into mba values (1,'Arun',20),(2,'saurabh',15),(3,'babau',20);
Query OK, 3 rows affected (0.10 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> insert into betch values (3,'aanaya',30),(6,'sabhu',35),(5,'sonu',22);
Query OK, 3 rows affected (0.42 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> select * from mba;
+---------+---------+------+
| roll_no | name | age |
+---------+---------+------+
| 1 | Arun | 20 |
| 2 | saurabh | 15 |
| 3 | babau | 20 |
+---------+---------+------+
3 rows in set (0.00 sec)
mysql> select * from betech;
ERROR 1146 (42S02): Table '[Link]' doesn't exist
mysql> select * from betch;
+---------+--------+------+
| roll_no | name | age |
+---------+--------+------+
| 3 | aanaya | 30 |
| 6 | sabhu | 35 |
| 5 | sonu | 22 |
+---------+--------+------+
3 rows in set (0.00 sec)
mysql> select * from betch union select * from mba;
+---------+---------+------+
| roll_no | name | age |
+---------+---------+------+
| 3 | aanaya | 30 |
| 6 | sabhu | 35 |
| 5 | sonu | 22 |
| 1 | Arun | 20 |
| 2 | saurabh | 15 |
| 3 | babau | 20 |
+---------+---------+------+
6 rows in set (0.00 sec)
mysql> select name ,age betch union select * from mba;
ERROR 1054 (42S22): Unknown column 'name' in 'field list'
mysql> select name ,age betch union select name , age from mba;
ERROR 1054 (42S22): Unknown column 'name' in 'field list'
mysql> select name,age from betch union select name,age from mba;
+---------+------+
| name | age |
+---------+------+
| aanaya | 30 |
| sabhu | 35 |
| sonu | 22 |
| Arun | 20 |
| saurabh | 15 |
| babau | 20 |
+---------+------+
6 rows in set (0.00 sec)
mysql> select * from betch union all select * from mba;
+---------+---------+------+
| roll_no | name | age |
+---------+---------+------+
| 3 | aanaya | 30 |
| 6 | sabhu | 35 |
| 5 | sonu | 22 |
| 1 | Arun | 20 |
| 2 | saurabh | 15 |
| 3 | babau | 20 |
+---------+---------+------+
6 rows in set (0.00 sec)
mysql> alter table betch rename column roll to stu_roll;
ERROR 1054 (42S22): Unknown column 'roll' in 'betch'
mysql> alter table betch rename column roll_no to stu_roll;
Query OK, 0 rows affected (0.61 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table betch rename column name to stu_name;
Query OK, 0 rows affected (0.30 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table betch rename column age to stu age;
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 'age' at
line 1
mysql> alter table betch rename column age to stu_age;
Query OK, 0 rows affected (0.31 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> select * from mba union all select * from betch;
+---------+---------+------+
| roll_no | name | age |
+---------+---------+------+
| 1 | Arun | 20 |
| 2 | saurabh | 15 |
| 3 | babau | 20 |
| 3 | aanaya | 30 |
| 6 | sabhu | 35 |
| 5 | sonu | 22 |
+---------+---------+------+
6 rows in set (0.00 sec)
mysql> select * from betch union all select * from mba;
+----------+----------+---------+
| stu_roll | stu_name | stu_age |
+----------+----------+---------+
| 3 | aanaya | 30 |
| 6 | sabhu | 35 |
| 5 | sonu | 22 |
| 1 | Arun | 20 |
| 2 | saurabh | 15 |
| 3 | babau | 20 |
+----------+----------+---------+
6 rows in set (0.00 sec)
mysql> select stu_name ,stu name ,stu_age from betch
-> union
-> select age,name,roll from mba;
ERROR 1054 (42S22): Unknown column 'stu' in 'field list'
mysql> select stu_name ,stu_roll ,stu_age from betch
-> union
-> select age,name,roll from mba;
ERROR 1054 (42S22): Unknown column 'roll' in 'field list'
mysql> select age,name,rollno from mba;
ERROR 1054 (42S22): Unknown column 'rollno' in 'field list'
mysql> desc mba;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| roll_no | int | YES | | NULL | |
| name | varchar(10) | YES | | NULL | |
| age | int | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
3 rows in set (0.08 sec)
mysql> select stu_name ,stu_roll ,stu_age from betch
-> union
-> select age,name,roll_no from mba;
+----------+----------+---------+
| stu_name | stu_roll | stu_age |
+----------+----------+---------+
| aanaya | 3 | 30 |
| sabhu | 6 | 35 |
| sonu | 5 | 22 |
| 20 | Arun | 1 |
| 15 | saurabh | 2 |
| 20 | babau | 3 |
+----------+----------+---------+
6 rows in set (0.00 sec)
mysql> select stu_name as A ,stu_roll As B ,stu_age As C from betch
-> union
-> select age,name,roll_no from mba;
+--------+---------+------+
| A | B | C |
+--------+---------+------+
| aanaya | 3 | 30 |
| sabhu | 6 | 35 |
| sonu | 5 | 22 |
| 20 | Arun | 1 |
| 15 | saurabh | 2 |
| 20 | babau | 3 |
+--------+---------+------+
6 rows in set (0.00 sec)
mysql> select * from betch
-> intersect
-> select * from mba;
Empty set (0.00 sec)
mysql> insert into betch values (1,'arun',20);
Query OK, 1 row affected (0.12 sec)
mysql> select * from betch
-> intersect
-> select * from mba;
+----------+----------+---------+
| stu_roll | stu_name | stu_age |
+----------+----------+---------+
| 1 | arun | 20 |
+----------+----------+---------+
1 row in set (0.00 sec)
mysql> select * from betch
-> except
-> select * from mba;
+----------+----------+---------+
| stu_roll | stu_name | stu_age |
+----------+----------+---------+
| 6 | sabhu | 35 |
| 3 | aanaya | 30 |
| 5 | sonu | 22 |
+----------+----------+---------+
3 rows in set (0.00 sec)
mysql>