Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
26 kB
2
Indexable
Never
it@c206:~$ sql
Command 'sql' not found, but can be installed with:
sudo apt install parallel
it@c206:~$ sudo mysql -u root -d
[sudo] password for it: 
Sorry, try again.
[sudo] password for it: 
mysql: [ERROR] mysql: unknown option '-d'.
it@c206:~$ sudo mysql -u root -d
mysql: [ERROR] mysql: unknown option '-d'.
it@c206:~$ sudo mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.33-0ubuntu0.22.04.4 (Ubuntu)

Copyright (c) 2000, 2023, 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> show databases
    -> show databases;
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 'show databases' at line 2
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| user               |
+--------------------+
5 rows in set (0.02 sec)

mysql> create database TYITB_67;
Query OK, 1 row affected (0.12 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| TYITB_67           |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| user               |
+--------------------+
6 rows in set (0.01 sec)

mysql> use TYITB_67;
Database changed
mysql> create table student();
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> 
mysql> create table student(int rollNo, varchar firstName(20), 
    -> 
    -> 
    -> ^DBye
it@c206:~$ sudo mysql -u root -p
[sudo] password for it: 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.33-0ubuntu0.22.04.4 (Ubuntu)

Copyright (c) 2000, 2023, 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 TYITB_67;
Database changed
mysql> create table students
    -> (int rollNo,
    -> varchar name(100);
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 rollNo,
varchar name(100)' at line 2
mysql> create table Students(
    -> int rollNo,
    -> varchar name(100),
    -> varchar add,
    -> date dob);
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 rollNo,
varchar name(100),
varchar add,
date dob)' at line 2
mysql> create table Students(int rollNo, varchar name(100), varchar add(100), date dob, float avg);
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 rollNo, varchar name(100), varchar add(100), date dob, float avg)' at line 1
mysql> create table Students(int rollNo, varchar name(100), varchar add(100), date dob, float avg);
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 rollNo, varchar name(100), varchar add(100), date dob, float avg)' at line 1
mysql> clear
mysql> cls
    -> 
    -> 
    -> ;
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 'cls' at line 1
mysql> create table Students ( rollNo int, name varchar(100), add varchar(100), dob date, avg float);
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 'add varchar(100), dob date, avg float)' at line 1
mysql> create table Students ( RollNo int, Name varchar(100), Add varchar(100), DOB date, Avg float);
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 'Add varchar(100), DOB date, Avg float)' at line 1
mysql> CREATE TABLE Students ( RollNo int, Name varchar(100), Add varchar(100), DOB date, Avg float);
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 'Add varchar(100), DOB date, Avg float)' at line 1
mysql> CREATE TABLE STUDENT (
    -> ROLLNO INT,
    -> NAME VARCHAR(100),
    -> ADDRESS VARCAHR(100),
    -> DOB DATE,
    -> AVERAGE FLOAT
    -> );
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 'VARCAHR(100),
DOB DATE,
AVERAGE FLOAT
)' at line 4
mysql> CREATE TABLE STUDENT (ROLLNO INT, NAME VARCHAR(100), ADDRESS VARCAHR(100), DOB DATE, AVERAGE DECIMAL(5,2));
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 'VARCAHR(100), DOB DATE, AVERAGE DECIMAL(5,2))' at line 1
mysql> CREATE TABLE STUDENT (ROLLNO INT, NAME VARCHAR(100), ADDRESS VARCHAR(100), DOB DATE, AVERAGE DECIMAL(5,2));

Query OK, 0 rows affected (1.10 sec)

mysql> SHOW TABLES;
+--------------------+
| Tables_in_TYITB_67 |
+--------------------+
| STUDENT            |
+--------------------+
1 row in set (0.01 sec)

mysql> DES STUDENT
    -> ;
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 'DES STUDENT' at line 1
mysql> DES STUDENT;
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 'DES STUDENT' at line 1
mysql> SHOW TABLES;
+--------------------+
| Tables_in_TYITB_67 |
+--------------------+
| STUDENT            |
+--------------------+
1 row in set (0.00 sec)

mysql> DESC STUDENT;
+---------+--------------+------+-----+---------+-------+
| Field   | Type         | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| ROLLNO  | int          | YES  |     | NULL    |       |
| NAME    | varchar(100) | YES  |     | NULL    |       |
| ADDRESS | varchar(100) | YES  |     | NULL    |       |
| DOB     | date         | YES  |     | NULL    |       |
| AVERAGE | decimal(5,2) | YES  |     | NULL    |       |
+---------+--------------+------+-----+---------+-------+
5 rows in set (0.02 sec)

mysql> INSERT INTO VALUES(67, 'CHETAN DAGAJI PATIL', 'KATRAJ, PUNE', '2003/12/04', 98.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 'VALUES(67, 'CHETAN DAGAJI PATIL', 'KATRAJ, PUNE', '2003/12/04', 98.6)' at line 1
mysql> INSERT INTO STUDENT VALUES(67, 'CHETAN DAGAJI PATIL', 'KATRAJ, PUNE', '04-12-03', 98.6);
Query OK, 1 row affected (0.11 sec)

mysql> SELECT * FROM STUDENT;
+--------+---------------------+--------------+------------+---------+
| ROLLNO | NAME                | ADDRESS      | DOB        | AVERAGE |
+--------+---------------------+--------------+------------+---------+
|     67 | CHETAN DAGAJI PATIL | KATRAJ, PUNE | 2004-12-03 |   98.60 |
+--------+---------------------+--------------+------------+---------+
1 row in set (0.00 sec)

mysql> INSERT INTO STUDENT VALUES(54, 'MAYUR SHETE', 'KONDHAWA, PUNE', '15-04-04', 96.6);
Query OK, 1 row affected (0.18 sec)

mysql> SELECT * FROM STUDENT;
+--------+---------------------+----------------+------------+---------+
| ROLLNO | NAME                | ADDRESS        | DOB        | AVERAGE |
+--------+---------------------+----------------+------------+---------+
|     67 | CHETAN DAGAJI PATIL | KATRAJ, PUNE   | 2004-12-03 |   98.60 |
|     54 | MAYUR SHETE         | KONDHAWA, PUNE | 2015-04-04 |   96.60 |
+--------+---------------------+----------------+------------+---------+
2 rows in set (0.00 sec)

mysql> INSERT INTO STUDENT VALUES(64, 'SHIWAM YELGIRE', 'BIBEWADI, PUNE', '2002-04-04', 96.6);
Query OK, 1 row affected (0.15 sec)

mysql> SELECT * FROM STUDENT;
+--------+---------------------+----------------+------------+---------+
| ROLLNO | NAME                | ADDRESS        | DOB        | AVERAGE |
+--------+---------------------+----------------+------------+---------+
|     67 | CHETAN DAGAJI PATIL | KATRAJ, PUNE   | 2004-12-03 |   98.60 |
|     54 | MAYUR SHETE         | KONDHAWA, PUNE | 2015-04-04 |   96.60 |
|     64 | SHIWAM YELGIRE      | BIBEWADI, PUNE | 2002-04-04 |   96.60 |
+--------+---------------------+----------------+------------+---------+
3 rows in set (0.00 sec)

mysql> UPDATE STUDENT SET DOB='2003-04-12' WHERE ROLLNO=67;
Query OK, 1 row affected (0.08 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT * FROM STUDENT;
+--------+---------------------+----------------+------------+---------+
| ROLLNO | NAME                | ADDRESS        | DOB        | AVERAGE |
+--------+---------------------+----------------+------------+---------+
|     67 | CHETAN DAGAJI PATIL | KATRAJ, PUNE   | 2003-04-12 |   98.60 |
|     54 | MAYUR SHETE         | KONDHAWA, PUNE | 2015-04-04 |   96.60 |
|     64 | SHIWAM YELGIRE      | BIBEWADI, PUNE | 2002-04-04 |   96.60 |
+--------+---------------------+----------------+------------+---------+
3 rows in set (0.00 sec)

mysql> UPDATE STUDENT SET DOB='2004-04-15' WHERE ROLLNO=54;
Query OK, 1 row affected (0.07 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT * FROM STUDENT;
+--------+---------------------+----------------+------------+---------+
| ROLLNO | NAME                | ADDRESS        | DOB        | AVERAGE |
+--------+---------------------+----------------+------------+---------+
|     67 | CHETAN DAGAJI PATIL | KATRAJ, PUNE   | 2003-04-12 |   98.60 |
|     54 | MAYUR SHETE         | KONDHAWA, PUNE | 2004-04-15 |   96.60 |
|     64 | SHIWAM YELGIRE      | BIBEWADI, PUNE | 2002-04-04 |   96.60 |
+--------+---------------------+----------------+------------+---------+
3 rows in set (0.00 sec)

mysql> SELECT * FROM STUDENT ORDER BY DOB
    -> ;
+--------+---------------------+----------------+------------+---------+
| ROLLNO | NAME                | ADDRESS        | DOB        | AVERAGE |
+--------+---------------------+----------------+------------+---------+
|     64 | SHIWAM YELGIRE      | BIBEWADI, PUNE | 2002-04-04 |   96.60 |
|     67 | CHETAN DAGAJI PATIL | KATRAJ, PUNE   | 2003-04-12 |   98.60 |
|     54 | MAYUR SHETE         | KONDHAWA, PUNE | 2004-04-15 |   96.60 |
+--------+---------------------+----------------+------------+---------+
3 rows in set (0.00 sec)

mysql> SELECT * FROM STUDENT ORDER BY DOB DEC
    -> ;
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 'DEC' at line 1
mysql> ALTER TABLE STUDENT EMAIL VARCAHR(100);
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 'EMAIL VARCAHR(100)' at line 1
mysql> ALTER TABLE STUDENT ADD EMAIL VARCAHR(100);
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 'VARCAHR(100)' at line 1
mysql> ALTER TABLE STUDENT ADD EMAIL VARCHAR(100);
Query OK, 0 rows affected (0.31 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> SELECT * FROM STUDENT;
+--------+---------------------+----------------+------------+---------+-------+
| ROLLNO | NAME                | ADDRESS        | DOB        | AVERAGE | EMAIL |
+--------+---------------------+----------------+------------+---------+-------+
|     67 | CHETAN DAGAJI PATIL | KATRAJ, PUNE   | 2003-04-12 |   98.60 | NULL  |
|     54 | MAYUR SHETE         | KONDHAWA, PUNE | 2004-04-15 |   96.60 | NULL  |
|     64 | SHIWAM YELGIRE      | BIBEWADI, PUNE | 2002-04-04 |   96.60 | NULL  |
+--------+---------------------+----------------+------------+---------+-------+
3 rows in set (0.00 sec)

mysql> UPDATE TABLE STUDENT SET EMAIL='chetan.22220069@viit.ac.in' WHERE ROLLNO=67;
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 'TABLE STUDENT SET EMAIL='chetan.22220069@viit.ac.in' WHERE ROLLNO=67' at line 1
mysql> UPDATE STUDENT SET EMAIL='chetan.22220069@viit.ac.in' WHERE ROLLNO=67;
Query OK, 1 row affected (0.07 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> UPDATE STUDENT SET EMAIL='mayur.22210824@viit.ac.in' WHERE ROLLNO=54;
Query OK, 1 row affected (0.08 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> UPDATE STUDENT SET EMAIL='shiwam.22110713@viit.ac.in' WHERE ROLLNO=64;
Query OK, 1 row affected (0.09 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT * FROM STUDENT;
+--------+---------------------+----------------+------------+---------+----------------------------+
| ROLLNO | NAME                | ADDRESS        | DOB        | AVERAGE | EMAIL                      |
+--------+---------------------+----------------+------------+---------+----------------------------+
|     67 | CHETAN DAGAJI PATIL | KATRAJ, PUNE   | 2003-04-12 |   98.60 | chetan.22220069@viit.ac.in |
|     54 | MAYUR SHETE         | KONDHAWA, PUNE | 2004-04-15 |   96.60 | mayur.22210824@viit.ac.in  |
|     64 | SHIWAM YELGIRE      | BIBEWADI, PUNE | 2002-04-04 |   96.60 | shiwam.22110713@viit.ac.in |
+--------+---------------------+----------------+------------+---------+----------------------------+
3 rows in set (0.00 sec)

mysql> ALTER TABLE STUDENT 
Display all 759 possibilities? (y or n) 
mysql> ALTER TABLE STUDENT MODIFY COLUMN ROLLNO VARCHAR(100);
Query OK, 3 rows affected (1.59 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> SELECT * FROM STUDENT;
+--------+---------------------+----------------+------------+---------+----------------------------+
| ROLLNO | NAME                | ADDRESS        | DOB        | AVERAGE | EMAIL                      |
+--------+---------------------+----------------+------------+---------+----------------------------+
| 67     | CHETAN DAGAJI PATIL | KATRAJ, PUNE   | 2003-04-12 |   98.60 | chetan.22220069@viit.ac.in |
| 54     | MAYUR SHETE         | KONDHAWA, PUNE | 2004-04-15 |   96.60 | mayur.22210824@viit.ac.in  |
| 64     | SHIWAM YELGIRE      | BIBEWADI, PUNE | 2002-04-04 |   96.60 | shiwam.22110713@viit.ac.in |
+--------+---------------------+----------------+------------+---------+----------------------------+
3 rows in set (0.00 sec)

mysql> DESC STUDENT;
+---------+--------------+------+-----+---------+-------+
| Field   | Type         | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| ROLLNO  | varchar(100) | YES  |     | NULL    |       |
| NAME    | varchar(100) | YES  |     | NULL    |       |
| ADDRESS | varchar(100) | YES  |     | NULL    |       |
| DOB     | date         | YES  |     | NULL    |       |
| AVERAGE | decimal(5,2) | YES  |     | NULL    |       |
| EMAIL   | varchar(100) | YES  |     | NULL    |       |
+---------+--------------+------+-----+---------+-------+
6 rows in set (0.00 sec)

mysql> UPDATE STUDENT SET EMAIL='shiwam.22110713@viit.ac.in' WHERE ROLLNO=64;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

mysql> SELECT * FROM STUDENT;
+--------+---------------------+----------------+------------+---------+----------------------------+
| ROLLNO | NAME                | ADDRESS        | DOB        | AVERAGE | EMAIL                      |
+--------+---------------------+----------------+------------+---------+----------------------------+
| 67     | CHETAN DAGAJI PATIL | KATRAJ, PUNE   | 2003-04-12 |   98.60 | chetan.22220069@viit.ac.in |
| 54     | MAYUR SHETE         | KONDHAWA, PUNE | 2004-04-15 |   96.60 | mayur.22210824@viit.ac.in  |
| 64     | SHIWAM YELGIRE      | BIBEWADI, PUNE | 2002-04-04 |   96.60 | shiwam.22110713@viit.ac.in |
+--------+---------------------+----------------+------------+---------+----------------------------+
3 rows in set (0.00 sec)

mysql> UPDATE STUDENT SET EMAIL='mayur.22110824@viit.ac.in', AVERAGE=94.50 WHERE ROLLNO=54;
Query OK, 1 row affected (0.07 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT * FROM STUDENT;
+--------+---------------------+----------------+------------+---------+----------------------------+
| ROLLNO | NAME                | ADDRESS        | DOB        | AVERAGE | EMAIL                      |
+--------+---------------------+----------------+------------+---------+----------------------------+
| 67     | CHETAN DAGAJI PATIL | KATRAJ, PUNE   | 2003-04-12 |   98.60 | chetan.22220069@viit.ac.in |
| 54     | MAYUR SHETE         | KONDHAWA, PUNE | 2004-04-15 |   94.50 | mayur.22110824@viit.ac.in  |
| 64     | SHIWAM YELGIRE      | BIBEWADI, PUNE | 2002-04-04 |   96.60 | shiwam.22110713@viit.ac.in |
+--------+---------------------+----------------+------------+---------+----------------------------+
3 rows in set (0.00 sec)

mysql> ALTER TABLE STUDENT ADD PRIMARY KEY (ROLLNO);
Query OK, 0 rows affected (1.54 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> DESC STUDENT;
+---------+--------------+------+-----+---------+-------+
| Field   | Type         | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| ROLLNO  | varchar(100) | NO   | PRI | NULL    |       |
| NAME    | varchar(100) | YES  |     | NULL    |       |
| ADDRESS | varchar(100) | YES  |     | NULL    |       |
| DOB     | date         | YES  |     | NULL    |       |
| AVERAGE | decimal(5,2) | YES  |     | NULL    |       |
| EMAIL   | varchar(100) | YES  |     | NULL    |       |
+---------+--------------+------+-----+---------+-------+
6 rows in set (0.00 sec)

mysql> CREATE TABLE COURSE (COURSEID VARCHAR(100), COURSENAME VARCHAR(100));
Query OK, 0 rows affected (0.38 sec)

mysql> SHOW TABLES;
+--------------------+
| Tables_in_TYITB_67 |
+--------------------+
| COURSE             |
| STUDENT            |
+--------------------+
2 rows in set (0.00 sec)

mysql> ALTER TABLE COURSE ADD PRIMARY KEY(COURSEID);
Query OK, 0 rows affected (1.05 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> DESC COURSE;
+------------+--------------+------+-----+---------+-------+
| Field      | Type         | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| COURSEID   | varchar(100) | NO   | PRI | NULL    |       |
| COURSENAME | varchar(100) | YES  |     | NULL    |       |
+------------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

mysql> ALTER TABLE STUDENT ADD COURSEID VARCAHR FOREIN KEY;
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 'VARCAHR FOREIN KEY' at line 1
mysql> ALTER TABLE STUDENT ADD COURSEID VARCHAR FOREIN KEY;
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 'FOREIN KEY' at line 1
mysql> ALTER TABLE STUDENT ADD COURSEID VARCHAR(100) FOREIN KEY;
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 'FOREIN KEY' at line 1
mysql> ALTER TABLE STUDENT ADD COURSEID VARCHAR(100);
Query OK, 0 rows affected (0.32 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> DESC STUDENT;
+----------+--------------+------+-----+---------+-------+
| Field    | Type         | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| ROLLNO   | varchar(100) | NO   | PRI | NULL    |       |
| NAME     | varchar(100) | YES  |     | NULL    |       |
| ADDRESS  | varchar(100) | YES  |     | NULL    |       |
| DOB      | date         | YES  |     | NULL    |       |
| AVERAGE  | decimal(5,2) | YES  |     | NULL    |       |
| EMAIL    | varchar(100) | YES  |     | NULL    |       |
| COURSEID | varchar(100) | YES  |     | NULL    |       |
+----------+--------------+------+-----+---------+-------+
7 rows in set (0.00 sec)

mysql> ALTER TABLE STUDENT ADD FOREIGN KEY(COURSEID);
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> ALTER TABLE STUDENT ADD FOREIGN KEY(COURSEID) REFERENCES COURSE(COURSEID);
Query OK, 3 rows affected (1.67 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> DESC STUDENT;
+----------+--------------+------+-----+---------+-------+
| Field    | Type         | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| ROLLNO   | varchar(100) | NO   | PRI | NULL    |       |
| NAME     | varchar(100) | YES  |     | NULL    |       |
| ADDRESS  | varchar(100) | YES  |     | NULL    |       |
| DOB      | date         | YES  |     | NULL    |       |
| AVERAGE  | decimal(5,2) | YES  |     | NULL    |       |
| EMAIL    | varchar(100) | YES  |     | NULL    |       |
| COURSEID | varchar(100) | YES  | MUL | NULL    |       |
+----------+--------------+------+-----+---------+-------+
7 rows in set (0.01 sec)

mysql> DESC COURSE;
+------------+--------------+------+-----+---------+-------+
| Field      | Type         | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| COURSEID   | varchar(100) | NO   | PRI | NULL    |       |
| COURSENAME | varchar(100) | YES  |     | NULL    |       |
+------------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

mysql> SELECT * FROM STUDENT;
+--------+---------------------+----------------+------------+---------+----------------------------+----------+
| ROLLNO | NAME                | ADDRESS        | DOB        | AVERAGE | EMAIL                      | COURSEID |
+--------+---------------------+----------------+------------+---------+----------------------------+----------+
| 54     | MAYUR SHETE         | KONDHAWA, PUNE | 2004-04-15 |   94.50 | mayur.22110824@viit.ac.in  | NULL     |
| 64     | SHIWAM YELGIRE      | BIBEWADI, PUNE | 2002-04-04 |   96.60 | shiwam.22110713@viit.ac.in | NULL     |
| 67     | CHETAN DAGAJI PATIL | KATRAJ, PUNE   | 2003-04-12 |   98.60 | chetan.22220069@viit.ac.in | NULL     |
+--------+---------------------+----------------+------------+---------+----------------------------+----------+
3 rows in set (0.00 sec)

mysql> INSERT INTO COURSE VALUES('VIIT_IT', 'INFORMATION TECHNOLOGY');
Query OK, 1 row affected (0.08 sec)

mysql> INSERT INTO COURSE VALUES('VIIT_COM', 'COMPUTER');
Query OK, 1 row affected (0.08 sec)

mysql> INSERT INTO COURSE VALUES('VIIT_AIDS', 'ARTIFICIAL INTELLIGENCE');
Query OK, 1 row affected (0.07 sec)

mysql> INSERT INTO COURSE VALUES('VIIT_ENTC', 'ELECTRONICS AND TELICOMMUNICATION');
Query OK, 1 row affected (0.08 sec)

mysql> INSERT INTO COURSE VALUES('VIIT_MECH', 'MECHANICAL');
Query OK, 1 row affected (0.05 sec)

mysql> INSERT INTO COURSE VALUES('VIIT_ELEC', 'ELECTRICAL');
Query OK, 1 row affected (0.08 sec)

mysql> INSERT INTO COURSE VALUES('VIIT_CIV', 'CIVIL');
Query OK, 1 row affected (0.08 sec)

mysql> SELECT * FROM COURSE;
+-----------+-----------------------------------+
| COURSEID  | COURSENAME                        |
+-----------+-----------------------------------+
| VIIT_AIDS | ARTIFICIAL INTELLIGENCE           |
| VIIT_CIV  | CIVIL                             |
| VIIT_COM  | COMPUTER                          |
| VIIT_ELEC | ELECTRICAL                        |
| VIIT_ENTC | ELECTRONICS AND TELICOMMUNICATION |
| VIIT_IT   | INFORMATION TECHNOLOGY            |
| VIIT_MECH | MECHANICAL                        |
+-----------+-----------------------------------+
7 rows in set (0.00 sec)

mysql> UPDATE STUDENT SET COURSEID='VIIT_IT' WHERE ROLLNO=67;
Query OK, 1 row affected (0.12 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT * FROM STUDENT;
+--------+---------------------+----------------+------------+---------+----------------------------+----------+
| ROLLNO | NAME                | ADDRESS        | DOB        | AVERAGE | EMAIL                      | COURSEID |
+--------+---------------------+----------------+------------+---------+----------------------------+----------+
| 54     | MAYUR SHETE         | KONDHAWA, PUNE | 2004-04-15 |   94.50 | mayur.22110824@viit.ac.in  | NULL     |
| 64     | SHIWAM YELGIRE      | BIBEWADI, PUNE | 2002-04-04 |   96.60 | shiwam.22110713@viit.ac.in | NULL     |
| 67     | CHETAN DAGAJI PATIL | KATRAJ, PUNE   | 2003-04-12 |   98.60 | chetan.22220069@viit.ac.in | VIIT_IT  |
+--------+---------------------+----------------+------------+---------+----------------------------+----------+
3 rows in set (0.00 sec)

mysql> UPDATE STUDENT SET COURSEID='VIIT_IT';
Query OK, 2 rows affected (0.08 sec)
Rows matched: 3  Changed: 2  Warnings: 0

mysql> SELECT * FROM STUDENT;
+--------+---------------------+----------------+------------+---------+----------------------------+----------+
| ROLLNO | NAME                | ADDRESS        | DOB        | AVERAGE | EMAIL                      | COURSEID |
+--------+---------------------+----------------+------------+---------+----------------------------+----------+
| 54     | MAYUR SHETE         | KONDHAWA, PUNE | 2004-04-15 |   94.50 | mayur.22110824@viit.ac.in  | VIIT_IT  |
| 64     | SHIWAM YELGIRE      | BIBEWADI, PUNE | 2002-04-04 |   96.60 | shiwam.22110713@viit.ac.in | VIIT_IT  |
| 67     | CHETAN DAGAJI PATIL | KATRAJ, PUNE   | 2003-04-12 |   98.60 | chetan.22220069@viit.ac.in | VIIT_IT  |
+--------+---------------------+----------------+------------+---------+----------------------------+----------+
3 rows in set (0.00 sec)