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

DBMS06.01 64

The document details a session in the MariaDB database management system, showcasing commands executed by the user. It includes operations such as showing databases, selecting a database, displaying tables, inserting records, using transactions, and rolling back changes. The final commands demonstrate the deletion of records and the subsequent rollback to restore the original data state.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

DBMS06.01 64

The document details a session in the MariaDB database management system, showcasing commands executed by the user. It includes operations such as showing databases, selecting a database, displaying tables, inserting records, using transactions, and rolling back changes. The final commands demonstrate the deletion of records and the subsequent rollback to restore the original data state.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

File: /home/lab04/DBMS06.

01_64 Page 1 of 2

(base) lab04@Comp25:~$ sudo mysql -u root


[sudo] password for lab04:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 37
Server version: 10.6.18-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;


+--------------------+
| Database |
+--------------------+
| OLAP |
| book |
| department
| function |
| information_schema |
| manisha |
| mysql |
| performance_schema |
| retail_sales |
| students |
+--------------------+
18 rows in set (0.000 sec)

MariaDB [(none)]> use students;


Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

MariaDB [students]> show tables;


+--------------------+
| Tables_in_students |
+--------------------+
| Employee |
| student1 |
| student2 |
+--------------------+
3 rows in set (0.000 sec)

MariaDB [students]> select * from student1;


+--------+----------+
| std_id | std_name |
+--------+----------+
| 1000 | abc |
| 1001 | abcd |
| 1002 | abcde |
+--------+----------+
3 rows in set (0.000 sec)

MariaDB [students]> start transaction;


Query OK, 0 rows affected (0.000 sec)

MariaDB [students]> savepoint P1;


Query OK, 0 rows affected (0.000 sec)

MariaDB [students]> insert into student1 values (1003,'back');


Query OK, 1 row affected (0.000 sec)

MariaDB [students]> savepoint P2;


Query OK, 0 rows affected (0.000 sec)

MariaDB [students]> insert into student1 values (1001,'abcaf');


File: /home/lab04/DBMS06.01_64 Page 2 of 2

Query OK, 1 row affected (0.000 sec)

MariaDB [students]> select * from student1;


+--------+----------+
| std_id | std_name |
+--------+----------+
| 1000 | abc |
| 1001 | abcd |
| 1002 | abcde |
| 1003 | back |
| 1001 | abcaf |
+--------+----------+
5 rows in set (0.000 sec)

MariaDB [students]> rollback to P2;


Query OK, 0 rows affected (0.000 sec)

MariaDB [students]> select * from student1;


+--------+----------+
| std_id | std_name |
+--------+----------+
| 1000 | abc |
| 1001 | abcd |
| 1002 | abcde |
| 1003 | back |
+--------+----------+
4 rows in set (0.000 sec)

MariaDB [students]> rollback to P1;


Query OK, 0 rows affected (0.000 sec)

MariaDB [students]> select * from student1;


+--------+----------+
| std_id | std_name |
+--------+----------+
| 1000 | abc |
| 1001 | abcd |
| 1002 | abcde |
+--------+----------+
3 rows in set (0.000 sec)

MariaDB [students]> delete from student1;


Query OK, 3 rows affected (0.000 sec)

MariaDB [students]> select * from student1;


Empty set (0.000 sec)

MariaDB [students]> rollback;


Query OK, 0 rows affected (0.000 sec)

MariaDB [students]> select * from student1;


+--------+----------+
| std_id | std_name |
+--------+----------+
| 1000 | abc |
| 1001 | abcd |
| 1002 | abcde |
+--------+----------+
3 rows in set (0.000 sec)

MariaDB [students]> exit


Bye

You might also like