0% found this document useful (0 votes)
11 views

Mysql

Uploaded by

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

Mysql

Uploaded by

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

Enter password: ***********

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

Your MySQL connection id is 21

Server version: 8.0.40 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> cc

Query OK, 1 row affected (0.06 sec)

mysql> use sports_management;

Database changed

mysql> create table sports(S_nos_no int unique auto_increment,name

-> varchar(20),years_of_service int(3),funding int(6));

Query OK, 0 rows affected, 2 warnings (0.07 sec)

mysql> desc sports;

+------------------+-------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+------------------+-------------+------+-----+---------+----------------+

| S_nos_no | int | NO | PRI | NULL | auto_increment |

| name | varchar(20) | YES | | NULL | |

| years_of_service | int | YES | | NULL | |

| funding | int | YES | | NULL | |

+------------------+-------------+------+-----+---------+----------------+
4 rows in set (0.05 sec)

mysql> insert into sports values(2,’Cricket’,9,25000);

ERROR 1054 (42S22): Unknown column '’Cricket’' in 'field list'

mysql> select*from sports;

Empty set (0.00 sec)

mysql> insert into sports values(2,’Cricket’,9,25000);

ERROR 1054 (42S22): Unknown column '’Cricket’' in 'field list'

mysql> insert into sports(S_nos_no,name,years_of_service,funding)values(2,’Cricket’,9,

-> 25000);

ERROR 1054 (42S22): Unknown column '’Cricket’' in 'field list'

mysql> insert into sports(S_nos_no,name,years_of_service,funding)values(2,'Cricket',9,

-> 25000);

Query OK, 1 row affected (0.04 sec)

mysql> insert into sports(S_nos_no,name,years_of_service,funding)values(3,'Basketball',7,

-> 10000);

Query OK, 1 row affected (0.01 sec)

mysql> insert into sports(S_nos_no,name,years_of_service,funding)values(4,'Badminton',3,

-> 9000);

Query OK, 1 row affected (0.03 sec)

mysql> insert into sports(S_nos_no,name,years_of_service,funding)values(5,'Tennis',5,

-> 15000);

Query OK, 1 row affected (0.03 sec)

mysql> select*from sports;

+----------+------------+------------------+---------+

| S_nos_no | name | years_of_service | funding |


+----------+------------+------------------+---------+

| 2 | Cricket | 9 | 25000 |

| 3 | Basketball | 7 | 10000 |

| 4 | Badminton | 3 | 9000 |

| 5 | Tennis | 5 | 15000 |

+----------+------------+------------------+---------+

4 rows in set (0.00 sec)

mysql> create table sports(S_nos_no int unique auto_increment,name varchar(30),

-> experience_years int(3),salary int(8));

ERROR 1050 (42S01): Table 'sports' already exists

mysql> 30),

-> experience_years int(3),salary int(8)); create table faculty(S_nos_no int unique


auto_increment,name varchar(

Query OK, 0 rows affected, 2 warnings (0.06 sec)

mysql> desc faculty;

+------------------+-------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+------------------+-------------+------+-----+---------+----------------+

| S_nos_no | int | NO | PRI | NULL | auto_increment |

| name | varchar(30) | YES | | NULL | |

| experience_years | int | YES | | NULL | |

| salary | int | YES | | NULL | |

+------------------+-------------+------+-----+---------+----------------+

4 rows in set (0.00 sec)

mysql> insert into faculty values(1,'Mr.Mahesh',11,35000);

Query OK, 1 row affected (0.04 sec)

mysql> insert into faculty values(2,'Mr.Shobhit',13,40000);


Query OK, 1 row affected (0.03 sec)

mysql> insert into faculty values(3,'Mr.Rahul',8,30000);

Query OK, 1 row affected (0.03 sec)

mysql> insert into faculty values(4,'Mrs.Sangeeta',19,100000);

Query OK, 1 row affected (0.03 sec)

mysql> insert into faculty values(5,'Mr.Robert',17,90000);

Query OK, 1 row affected (0.01 sec)

mysql> select*from faculty;

+----------+--------------+------------------+--------+

| S_nos_no | name | experience_years | salary |

+----------+--------------+------------------+--------+

| 1 | Mr.Mahesh | 11 | 35000 |

| 2 | Mr.Shobhit | 13 | 40000 |

| 3 | Mr.Rahul | 8 | 30000 |

| 4 | Mrs.Sangeeta | 19 | 100000 |

| 5 | Mr.Robert | 17 | 90000 |

+----------+--------------+------------------+--------+

5 rows in set (0.00 sec)

mysql> create table students(S_nos_no int unique auto_increment,sport varchar(20),

-> Number_Of_Students int(4),Senior_Wing int(4),Junior_Wing int(4));

Query OK, 0 rows affected, 3 warnings (0.09 sec)

mysql> desc students;

+--------------------+-------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+--------------------+-------------+------+-----+---------+----------------+
| S_nos_no | int | NO | PRI | NULL | auto_increment |

| sport | varchar(20) | YES | | NULL | |

| Number_Of_Students | int | YES | | NULL | |

| Senior_Wing | int | YES | | NULL | |

| Junior_Wing | int | YES | | NULL | |

+--------------------+-------------+------+-----+---------+----------------+

5 rows in set (0.00 sec)

mysql> insert into students values(1,'Football',31,18,13);

Query OK, 1 row affected (0.04 sec)

mysql> insert into students values(2,'Cricket',60,31,29);

Query OK, 1 row affected (0.03 sec)

mysql> insert into students values(3,'Basketball',30,15,15);

Query OK, 1 row affected (0.04 sec)

mysql> insert into students values(4,'Badminton',8,4,4);

Query OK, 1 row affected (0.03 sec)

mysql> insert into students values(5,'Tennis',11,5,6);

Query OK, 1 row affected (0.03 sec)

mysql> select*from students;

+----------+------------+--------------------+-------------+-------------+

| S_nos_no | sport | Number_Of_Students | Senior_Wing | Junior_Wing |

+----------+------------+--------------------+-------------+-------------+

| 1 | Football | 31 | 18 | 13 |

| 2 | Cricket | 60 | 31 | 29 |

| 3 | Basketball | 30 | 15 | 15 |

| 4 | Badminton | 8| 4| 4|
| 5 | Tennis | 11 | 5| 6|

+----------+------------+--------------------+-------------+-------------+

5 rows in set (0.00 sec)

mysql>

mysql> create table accolades(S_nos_no int unique

-> auto_increment,sport varchar(20),competitions_won int(4),state_ranking int(4));

Query OK, 0 rows affected, 2 warnings (0.08 sec)

mysql> desc accolades;

+------------------+-------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+------------------+-------------+------+-----+---------+----------------+

| S_nos_no | int | NO | PRI | NULL | auto_increment |

| sport | varchar(20) | YES | | NULL | |

| competitions_won | int | YES | | NULL | |

| state_ranking | int | YES | | NULL | |

+------------------+-------------+------+-----+---------+----------------+

4 rows in set (0.00 sec)

mysql> insert into accolades values(1,'Football',17,3);

Query OK, 1 row affected (0.04 sec)

mysql> insert into accolades values(2,'Cricket',6,14);

Query OK, 1 row affected (0.04 sec)

mysql> insert into accolades values(3,'Basketball',7,39);

Query OK, 1 row affected (0.01 sec)

mysql> insert into accolades values(4,'Badminton',9,4);

Query OK, 1 row affected (0.03 sec)


mysql> insert into accolades values(5,'Tennis',2,41);

Query OK, 1 row affected (0.01 sec)

mysql> select*from accolades;

+----------+------------+------------------+---------------+

| S_nos_no | sport | competitions_won | state_ranking |

+----------+------------+------------------+---------------+

| 1 | Football | 17 | 3|

| 2 | Cricket | 6| 14 |

| 3 | Basketball | 7| 39 |

| 4 | Badminton | 9| 4|

| 5 | Tennis | 2| 41 |

+----------+------------+------------------+---------------+

5 rows in set (0.00 sec)

mysql> create table assets(S_nos_no int unique

-> auto_increment,sport

-> varchar(20),Training_Centre

-> varchar(20),Net_Assets_Worth int(6));

Query OK, 0 rows affected, 1 warning (0.06 sec)

mysql> desc assets;

+------------------+-------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+------------------+-------------+------+-----+---------+----------------+

| S_nos_no | int | NO | PRI | NULL | auto_increment |

| sport | varchar(20) | YES | | NULL | |

| Training_Centre | varchar(20) | YES | | NULL | |

| Net_Assets_Worth | int | YES | | NULL | |

+------------------+-------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

mysql> insert into assets values(1,’Football’,’Main Ground’,20000);

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 'Ground’,20000)' at line 1

mysql> insert into assets values(1,'Football','Main Ground',20000);

Query OK, 1 row affected (0.03 sec)

mysql> insert into assets values(2,'Cricket','Main Ground',25000);

Query OK, 1 row affected (0.04 sec)

mysql> insert into assets values(3,'Basketball','Basketball Court',19000);

Query OK, 1 row affected (0.04 sec)

mysql> insert into assets values(4,'Badminton','Badminton Court',10000);

Query OK, 1 row affected (0.04 sec)

mysql> insert into assets values(5,'Tennis','Tennis Court',9000);

Query OK, 1 row affected (0.01 sec)

mysql> select*from assets;

+----------+------------+------------------+------------------+

| S_nos_no | sport | Training_Centre | Net_Assets_Worth |

+----------+------------+------------------+------------------+

| 1 | Football | Main Ground | 20000 |

| 2 | Cricket | Main Ground | 25000 |

| 3 | Basketball | Basketball Court | 19000 |

| 4 | Badminton | Badminton Court | 10000 |

| 5 | Tennis | Tennis Court | 9000 |

+----------+------------+------------------+------------------+

5 rows in set (0.00 sec)


mysql>

You might also like