Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> -+ -> -> -> create a database 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 '-+ create a database student' at line 1 mysql> create database student; Query OK, 1 row affected (0.00 sec) mysql> create tabe 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 'tabe student' at line 1 mysql> create table student; ERROR 1046 (3D000): No database selected mysql> use student; Database changed mysql> create table student(roll_no varchar(4) , name varchar(20) , marks_dsa numeric(5,2) , marks_python numeric(5,2) , marks_math numeric(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 '' at line 1 mysql> create table student(roll_no varchar(4) , name varchar(20) , marks_dsa numeric(5,2) , marks_python numeric(5,2) , marks_math numeric(5,2)); Query OK, 0 rows affected (0.01 sec) mysql> desc student; +--------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+--------------+------+-----+---------+-------+ | roll_no | varchar(4) | YES | | NULL | | | name | varchar(20) | YES | | NULL | | | marks_dsa | decimal(5,2) | YES | | NULL | | | marks_python | decimal(5,2) | YES | | NULL | | | marks_math | decimal(5,2) | YES | | NULL | | +--------------+--------------+------+-----+---------+-------+ 5 rows in set (0.02 sec) mysql> insert into student values('a001','aditya',80,75,95); Query OK, 1 row affected (0.02 sec) mysql> insert into student values('a003','shaad',50,75,15); Query OK, 1 row affected (0.03 sec) mysql> insert into student values('a014','rishit',02,12,18); Query OK, 1 row affected (0.00 sec) mysql> insert into student values('a045','hiteshi',98,97,84); Query OK, 1 row affected (0.02 sec) mysql> insert into student values('a032','ansel',38,67,24); Query OK, 1 row affected (0.01 sec) mysql> select * from student; +---------+---------+-----------+--------------+------------+ | roll_no | name | marks_dsa | marks_python | marks_math | +---------+---------+-----------+--------------+------------+ | a001 | aditya | 80.00 | 75.00 | 95.00 | | a003 | shaad | 50.00 | 75.00 | 15.00 | | a014 | rishit | 2.00 | 12.00 | 18.00 | | a045 | hiteshi | 98.00 | 97.00 | 84.00 | | a032 | ansel | 38.00 | 67.00 | 24.00 | +---------+---------+-----------+--------------+------------+ 5 rows in set (0.00 sec) mysql> alter table student add column percentage numeric(5,2); Query OK, 5 rows affected (0.03 sec) Records: 5 Duplicates: 0 Warnings: 0 mysql> select * from student; +---------+---------+-----------+--------------+------------+------------+ | roll_no | name | marks_dsa | marks_python | marks_math | percentage | +---------+---------+-----------+--------------+------------+------------+ | a001 | aditya | 80.00 | 75.00 | 95.00 | NULL | | a003 | shaad | 50.00 | 75.00 | 15.00 | NULL | | a014 | rishit | 2.00 | 12.00 | 18.00 | NULL | | a045 | hiteshi | 98.00 | 97.00 | 84.00 | NULL | | a032 | ansel | 38.00 | 67.00 | 24.00 | NULL | +---------+---------+-----------+--------------+------------+------------+ 5 rows in set (0.00 sec) mysql> update table student set percentage = (marks_python + marks_dsa + marks_math)/3; 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 percentage = (marks_python + marks_dsa + marks_math)/3' at line 1 mysql> update student set percentage = (marks_python + marks_dsa + marks_math)/3; Query OK, 5 rows affected, 3 warnings (0.01 sec) Rows matched: 5 Changed: 5 Warnings: 3 mysql> select * from student; +---------+---------+-----------+--------------+------------+------------+ | roll_no | name | marks_dsa | marks_python | marks_math | percentage | +---------+---------+-----------+--------------+------------+------------+ | a001 | aditya | 80.00 | 75.00 | 95.00 | 83.33 | | a003 | shaad | 50.00 | 75.00 | 15.00 | 46.67 | | a014 | rishit | 2.00 | 12.00 | 18.00 | 10.67 | | a045 | hiteshi | 98.00 | 97.00 | 84.00 | 93.00 | | a032 | ansel | 38.00 | 67.00 | 24.00 | 43.00 | +---------+---------+-----------+--------------+------------+------------+ 5 rows in set (0.00 sec) mysql> alter table student add column grade char; Query OK, 5 rows affected (0.02 sec) Records: 5 Duplicates: 0 Warnings: 0 mysql> update student set grade = 'A' where percentage > 80 and percentage <= 90; Query OK, 1 row affected (0.02 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> update student set grade = 'B' where percentage > 70 and percentage <= 80; Query OK, 0 rows affected (0.00 sec) Rows matched: 0 Changed: 0 Warnings: 0 mysql> update student set grade = 'C' where percentage > 60 and percentage <= 70; Query OK, 0 rows affected (0.00 sec) Rows matched: 0 Changed: 0 Warnings: 0 mysql> update student set grade = 'D' where percentage > 50 and percentage <= 60; Query OK, 0 rows affected (0.00 sec) Rows matched: 0 Changed: 0 Warnings: 0 mysql> update student set grade = 'F' where percentage <= 50; Query OK, 3 rows affected (0.03 sec) Rows matched: 3 Changed: 3 Warnings: 0 mysql> update student set grade = 'o' where percentage >90; Query OK, 1 row affected (0.02 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from student; +---------+---------+-----------+--------------+------------+------------+-------+ | roll_no | name | marks_dsa | marks_python | marks_math | percentage | grade | +---------+---------+-----------+--------------+------------+------------+-------+ | a001 | aditya | 80.00 | 75.00 | 95.00 | 83.33 | A | | a003 | shaad | 50.00 | 75.00 | 15.00 | 46.67 | F | | a014 | rishit | 2.00 | 12.00 | 18.00 | 10.67 | F | | a045 | hiteshi | 98.00 | 97.00 | 84.00 | 93.00 | o | | a032 | ansel | 38.00 | 67.00 | 24.00 | 43.00 | F | +---------+---------+-----------+--------------+------------+------------+-------+ 5 rows in set (0.00 sec) mysql> select * from student;