0% found this document useful (0 votes)
12 views5 pages

Dbms

Uploaded by

THARUN TEJAS K S
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)
12 views5 pages

Dbms

Uploaded by

THARUN TEJAS K S
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/ 5

Microsoft Windows [Version 10.0.22000.

2538]
(c) Microsoft Corporation. All rights reserved.

C:\Users\students>cd |
The syntax of the command is incorrect.

C:\Users\students>cd \

C:\>cd "program files"

C:\Program Files>cd MySQL

C:\Program Files\MySQL>cd "MySQL Server 8.0"

C:\Program Files\MySQL\MySQL Server 8.0>cd bin

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u 1si22ad044 -p


Enter password: **********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.39 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> create database database1;


Query OK, 1 row affected (0.08 sec)

mysql> connect database1;


Connection id: 15
Current database: database1

mysql> create table STUDENT(name varchar(50), USN varchar(10),sem int);


Query OK, 0 rows affected (0.91 sec)

mysql> desc STUDENT;


+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| name | varchar(50) | YES | | NULL | |
| USN | varchar(10) | YES | | NULL | |
| sem | int | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
3 rows in set (0.09 sec)

mysql> drop table STUDENT;


Query OK, 0 rows affected (0.34 sec)

mysql> desc STUDENT;


ERROR 1146 (42S02): Table 'database1.student' doesn't exist
mysql> create table STUDENT(Name varchar(50),USN varchar(10),Sem int,Adrress
varchar(100),Email varchar(50),Branch varchar(50),phoneno int,DOB int,m1 int,m2
int,m3 int);
Query OK, 0 rows affected (0.54 sec)
mysql> desc STUDENT;
+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| Name | varchar(50) | YES | | NULL | |
| USN | varchar(10) | YES | | NULL | |
| Sem | int | YES | | NULL | |
| Adrress | varchar(100) | YES | | NULL | |
| Email | varchar(50) | YES | | NULL | |
| Branch | varchar(50) | YES | | NULL | |
| phoneno | int | YES | | NULL | |
| DOB | int | YES | | NULL | |
| m1 | int | YES | | NULL | |
| m2 | int | YES | | NULL | |
| m3 | int | YES | | NULL | |
+---------+--------------+------+-----+---------+-------+
11 rows in set (0.00 sec)

mysql> create table EMPLOYEE(EName varchar(50),EID varchar(10),Designation


varchar(50),Department varchar(50),Salary Decimal(9,2),Address varchar(50),Phoneno
int,Emailid varchar(50),BirthYear int,YOJ int,Age int,No_of_years_of_exp int);
Query OK, 0 rows affected (0.41 sec)

mysql> desc EMPLOYEE;


+--------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+--------------+------+-----+---------+-------+
| EName | varchar(50) | YES | | NULL | |
| EID | varchar(10) | YES | | NULL | |
| Designation | varchar(50) | YES | | NULL | |
| Department | varchar(50) | YES | | NULL | |
| Salary | decimal(9,2) | YES | | NULL | |
| Address | varchar(50) | YES | | NULL | |
| Phoneno | int | YES | | NULL | |
| Emailid | varchar(50) | YES | | NULL | |
| BirthYear | int | YES | | NULL | |
| YOJ | int | YES | | NULL | |
| Age | int | YES | | NULL | |
| No_of_years_of_exp | int | YES | | NULL | |
+--------------------+--------------+------+-----+---------+-------+
12 rows in set (0.00 sec)

mysql> select * from STUDENT;


Empty set (0.04 sec)

mysql> insert into STUDENT values("SHUBHA",1SI22AD044,5,"SIT extension 11th


cross","shubha@gmail.com","AI and DS",7204743192,2004,99,98,100);
ERROR 1054 (42S22): Unknown column '1SI22AD044' in 'field list'
mysql> insert into STUDENT values("SHUBHA","1si22ad044",5,"SIT extension 11th
cross","shubha@gmail.com","AI and DS",7204743192,2004,99,98,100);
ERROR 1264 (22003): Out of range value for column 'phoneno' at row 1
mysql> insert into STUDENT values("SHUBHA","1si22ad044",5,"SIT extension 11th
cross","shubha@gmail.com","AI and DS",108,98,99,100);
ERROR 1136 (21S01): Column count doesn't match value count at row 1
mysql> insert into STUDENT values("SHUBHA","1si22ad044",5,"SIT extension 11th
cross","shubha@gmail.com","AI and DS",7204743192,2004,99,98,100);
ERROR 1264 (22003): Out of range value for column 'phoneno' at row 1
mysql> insert into STUDENT values("SHUBHA","1si22ad044",5,"SIT extension 11th
cross","shubha@gmail.com","AI and DS",108,2004,98,99,100);
Query OK, 1 row affected (0.07 sec)

mysql> select * from STUDENT;


+--------+------------+------+--------------------------+------------------
+-----------+---------+------+------+------+------+
| Name | USN | Sem | Adrress | Email | Branch
| phoneno | DOB | m1 | m2 | m3 |
+--------+------------+------+--------------------------+------------------
+-----------+---------+------+------+------+------+
| SHUBHA | 1si22ad044 | 5 | SIT extension 11th cross | shubha@gmail.com | AI and
DS | 108 | 2004 | 98 | 99 | 100 |
+--------+------------+------+--------------------------+------------------
+-----------+---------+------+------+------+------+
1 row in set (0.00 sec)

mysql> insert into STUDEN


values("SADHANA","1si22ad039",5,"jaynagar","sadhana@gmail.com","AI and
DS",985662231,280304,98,75,84);
ERROR 1146 (42S02): Table 'database1.studen' doesn't exist
mysql> insert into STUDENT
values("SADHANA","1si22ad039",5,"jaynagar","sadhana@gmail.com","AI and
DS",985662231,280304,98,75,84);
Query OK, 1 row affected (0.12 sec)

mysql> insert into STUDENT values("ANANYA","1SI22AD002",5,"RR


Nagar","Ananya@gmail.com","AI and DS",8755625664,071004,84,56,25);
ERROR 1264 (22003): Out of range value for column 'phoneno' at row 1
mysql> insert into STUDENT values("ANANYA","1SI22AD002",5,"RR
Nagar","Ananya@gmail.com","AI and DS",87556255,071004,84,54,65);
Query OK, 1 row affected (0.04 sec)

mysql> select * from STUDENT;


+---------+------------+------+--------------------------+-------------------
+-----------+-----------+--------+------+------+------+
| Name | USN | Sem | Adrress | Email |
Branch | phoneno | DOB | m1 | m2 | m3 |
+---------+------------+------+--------------------------+-------------------
+-----------+-----------+--------+------+------+------+
| SHUBHA | 1si22ad044 | 5 | SIT extension 11th cross | shubha@gmail.com | AI
and DS | 108 | 2004 | 98 | 99 | 100 |
| SADHANA | 1si22ad039 | 5 | jaynagar | sadhana@gmail.com | AI
and DS | 985662231 | 280304 | 98 | 75 | 84 |
| ANANYA | 1SI22AD002 | 5 | RR Nagar | Ananya@gmail.com | AI
and DS | 87556255 | 71004 | 84 | 54 | 65 |
+---------+------------+------+--------------------------+-------------------
+-----------+-----------+--------+------+------+------+
3 rows in set (0.00 sec)

mysql> insert into STUDENT


values("PRAGA","1si22ad015",5,"Newyork","praga@gmail.com","AI and
DS",745336263,130204,74,56,48);
Query OK, 1 row affected (0.06 sec)

mysql> insert into STUDENT


values("POOJA","1si22ad016",5,"Mumbai","pooja@gmail.com","AI and
DS",8463213333,190604,47,85,92);
ERROR 1264 (22003): Out of range value for column 'phoneno' at row 1
mysql> insert into STUDENT
values("POOJA","1si22ad016",5,"Mumbai","pooja@gmail.com","AI and
DS",84632133,190604,47,85,92);
Query OK, 1 row affected (0.04 sec)

mysql> select * from STUDENT;


+---------+------------+------+--------------------------+-------------------
+-----------+-----------+--------+------+------+------+
| Name | USN | Sem | Adrress | Email |
Branch | phoneno | DOB | m1 | m2 | m3 |
+---------+------------+------+--------------------------+-------------------
+-----------+-----------+--------+------+------+------+
| SHUBHA | 1si22ad044 | 5 | SIT extension 11th cross | shubha@gmail.com | AI
and DS | 108 | 2004 | 98 | 99 | 100 |
| SADHANA | 1si22ad039 | 5 | jaynagar | sadhana@gmail.com | AI
and DS | 985662231 | 280304 | 98 | 75 | 84 |
| ANANYA | 1SI22AD002 | 5 | RR Nagar | Ananya@gmail.com | AI
and DS | 87556255 | 71004 | 84 | 54 | 65 |
| PRAGA | 1si22ad015 | 5 | Newyork | praga@gmail.com | AI
and DS | 745336263 | 130204 | 74 | 56 | 48 |
| POOJA | 1si22ad016 | 5 | Mumbai | pooja@gmail.com | AI
and DS | 84632133 | 190604 | 47 | 85 | 92 |
+---------+------------+------+--------------------------+-------------------
+-----------+-----------+--------+------+------+------+
5 rows in set (0.00 sec)

mysql> insert into STUDENT(Name)


-> values("Anu");
Query OK, 1 row affected (0.09 sec)

mysql> select * from STUDENT;


+---------+------------+------+--------------------------+-------------------
+-----------+-----------+--------+------+------+------+
| Name | USN | Sem | Adrress | Email |
Branch | phoneno | DOB | m1 | m2 | m3 |
+---------+------------+------+--------------------------+-------------------
+-----------+-----------+--------+------+------+------+
| SHUBHA | 1si22ad044 | 5 | SIT extension 11th cross | shubha@gmail.com | AI
and DS | 108 | 2004 | 98 | 99 | 100 |
| SADHANA | 1si22ad039 | 5 | jaynagar | sadhana@gmail.com | AI
and DS | 985662231 | 280304 | 98 | 75 | 84 |
| ANANYA | 1SI22AD002 | 5 | RR Nagar | Ananya@gmail.com | AI
and DS | 87556255 | 71004 | 84 | 54 | 65 |
| PRAGA | 1si22ad015 | 5 | Newyork | praga@gmail.com | AI
and DS | 745336263 | 130204 | 74 | 56 | 48 |
| POOJA | 1si22ad016 | 5 | Mumbai | pooja@gmail.com | AI
and DS | 84632133 | 190604 | 47 | 85 | 92 |
| Anu | NULL | NULL | NULL | NULL | NULL
| NULL | NULL | NULL | NULL | NULL |
+---------+------------+------+--------------------------+-------------------
+-----------+-----------+--------+------+------+------+
6 rows in set (0.00 sec)

mysql> alter table STUDENT


-> add primary key (USN);
ERROR 1138 (22004): Invalid use of NULL value
mysql>
mysql> ALTER TABLE STUDENT
-> ADD PRIMARY KEY (USN);
ERROR 1138 (22004): Invalid use of NULL value
mysql> ALTER TABLE your_table
-> ADD CONSTRAINT pk_column_name PRIMARY KEY (column_name);
ERROR 1146 (42S02): Table 'database1.your_table' doesn't exist
mysql> ALTER TABLE STUDENT
-> ADD CONSTRAINT USN PRIMARY KEY (USN);
ERROR 1138 (22004): Invalid use of NULL value
mysql> ALTER TABLE STUDENT
-> ADD CONSTRAINT pk_USN PRIMARY KEY (USN);
ERROR 1138 (22004): Invalid use of NULL value
mysql> insert into STUDENT(Name,USN,Sem,Adrress)
-> values("Siri","1si22ad087",5,"yalk"),
-> ("renu","1si22ad078",5,"Gubbi");
Query OK, 2 rows affected (0.07 sec)
Records: 2 Duplicates: 0 Warnings: 0

mysql> select * from STUDENT;


+---------+------------+------+--------------------------+-------------------
+-----------+-----------+--------+------+------+------+
| Name | USN | Sem | Adrress | Email |
Branch | phoneno | DOB | m1 | m2 | m3 |
+---------+------------+------+--------------------------+-------------------
+-----------+-----------+--------+------+------+------+
| SHUBHA | 1si22ad044 | 5 | SIT extension 11th cross | shubha@gmail.com | AI
and DS | 108 | 2004 | 98 | 99 | 100 |
| SADHANA | 1si22ad039 | 5 | jaynagar | sadhana@gmail.com | AI
and DS | 985662231 | 280304 | 98 | 75 | 84 |
| ANANYA | 1SI22AD002 | 5 | RR Nagar | Ananya@gmail.com | AI
and DS | 87556255 | 71004 | 84 | 54 | 65 |
| PRAGA | 1si22ad015 | 5 | Newyork | praga@gmail.com | AI
and DS | 745336263 | 130204 | 74 | 56 | 48 |
| POOJA | 1si22ad016 | 5 | Mumbai | pooja@gmail.com | AI
and DS | 84632133 | 190604 | 47 | 85 | 92 |
| Anu | NULL | NULL | NULL | NULL | NULL
| NULL | NULL | NULL | NULL | NULL |
| Siri | 1si22ad087 | 5 | yalk | NULL | NULL
| NULL | NULL | NULL | NULL | NULL |
| renu | 1si22ad078 | 5 | Gubbi | NULL | NULL
| NULL | NULL | NULL | NULL | NULL |
+---------+------------+------+--------------------------+-------------------
+-----------+-----------+--------+------+------+------+
8 rows in set (0.00 sec)

mysql>

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy