0% found this document useful (0 votes)
5 views2 pages

sql

A MySQL database named 'Angel' was created, and a table 'info' was defined with fields for roll number, name, and marks. Several records were inserted into the table, and queries were executed to retrieve and update data, including filtering names based on marks. Additionally, the table structure was modified to include a new column for class, which was later altered to change its data type.

Uploaded by

angeljatolia13
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)
5 views2 pages

sql

A MySQL database named 'Angel' was created, and a table 'info' was defined with fields for roll number, name, and marks. Several records were inserted into the table, and queries were executed to retrieve and update data, including filtering names based on marks. Additionally, the table structure was modified to include a new column for class, which was later altered to change its data type.

Uploaded by

angeljatolia13
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/ 2

mysql> Create database Angel;

Query OK, 1 row affected (0.00 sec)

mysql> use angel;


Database changed
mysql> create table info(
-> rollno int(2),
-> name varchar(12),
-> marks decimal(4,2)
-> );
Query OK, 0 rows affected (0.09 sec)

mysql> use angel;


Database changed
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| angel |
| anyam |
| mysql |
| test |
+--------------------+
5 rows in set (0.00 sec)

mysql> desc info;


+--------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------+------+-----+---------+-------+
| rollno | int(2) | YES | | NULL | |
| name | varchar(12) | YES | | NULL | |
| marks | decimal(4,2) | YES | | NULL | |
+--------+--------------+------+-----+---------+-------+
3 rows in set (0.15 sec)

mysql> insert into info(rollno,name)


-> values(4,'Radhika');
Query OK, 1 row affected (0.06 sec)

mysql> select * from info;


+--------+---------+-------+
| rollno | name | marks |
+--------+---------+-------+
| 4 | Radhika | NULL |
+--------+---------+-------+
1 row in set (0.01 sec)
mysql> insert into info(rollno,name,marks)
-> values(5,'Yashika',80);
Query OK, 1 row affected (0.13 sec)

mysql> insert into info(rollno,name,marks)


-> values(6,'Seema',98);
Query OK, 1 row affected (0.03 sec)

mysql> insert into info(rollno,name,marks)


-> values(7,'Tanisha',96);
Query OK, 1 row affected (0.03 sec)
mysql> select name from info where marks>90;
+---------+
| name |
+---------+
| Seema |
| Tanisha |
+---------+
2 rows in set (0.03 sec)
mysql> update info set marks=46 where rollno=4;
Query OK, 1 row affected (0.06 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> Alter table info


-> add class varchar(4);
Query OK, 4 rows affected (0.36 sec)
Records: 4 Duplicates: 0 Warnings: 0

mysql> Alter table info


-> modify class integer(12);
Query OK, 4 rows affected (0.21 sec)
Records: 4 Duplicates: 0 Warnings: 0

mysql> select * from info;


+--------+---------+-------+-------+
| rollno | name | marks | class |
+--------+---------+-------+-------+
| 4 | Radhika | 46.00 | NULL |
| 5 | Yashika | 80.00 | NULL |
| 6 | Seema | 98.00 | NULL |
| 7 | Tanisha | 96.00 | NULL |
+--------+---------+-------+-------+
4 rows in set (0.00 sec)

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