0% found this document useful (0 votes)
19 views7 pages

Act 1

The document provides instructions for interacting with databases and tables using SQL commands in MySQL. It has the student perform tasks like logging in, listing databases, creating and deleting databases, describing tables, and identifying fields. The student is asked to provide the SQL commands and output for 33 different instructions and tasks.

Uploaded by

wenzduke3098
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)
19 views7 pages

Act 1

The document provides instructions for interacting with databases and tables using SQL commands in MySQL. It has the student perform tasks like logging in, listing databases, creating and deleting databases, describing tables, and identifying fields. The student is asked to provide the SQL commands and output for 33 different instructions and tasks.

Uploaded by

wenzduke3098
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/ 7

Name: Wency S.

Duquque
Course & Year: BSINTE 2B

Database Management System 1


Laboratory Activity
Basic Commands and Operations

Instruction: Please follow the instructions below. Then give the SQL commands and
values.
Please use this document to place your answers.

1. Login to your MySQL Command Client


Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.26 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

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>

2. Show the available/ existing databases


mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| db011 |
| db_edp |
| db_fores |
| db_forse |
| db_pie |
| db_pis |
| db_school |
| db_test |
| dbluser |
| dbmanzano02 |
| dbpos |
| dbprieto01 |
| dbprojects |
| dbsalesa |
| dbsalesb |
| dbworks |
| dp_pis |
| mysql |
| performance_schema |
| sakila |
| sys |
| world |
+--------------------+

3. How many databases do you have on your server?


23 rows in set (0.04 sec)
4. Identify these databases.
mysql> use mysql;
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| engine_cost |
| event |
| func |
| general_log |
| gtid_executed |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| innodb_index_stats |
| innodb_table_stats |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| server_cost |
| servers |
| slave_master_info |
| slave_relay_log_info |
| slave_worker_info |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
5. How many tables are available in databse "mysql"?
31 rows in set (0.00 sec)
6. Identify and display the attributes of table "db" under "mysql" database.
mysql> describe db;
+-----------------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+---------------+------+-----+---------+-------+
| Host | char (60) | NO | PRI | | |
| Db | char (64) | NO | PRI | | |
| User | char (32) | NO | PRI | | |
| Select_priv | enum('N','Y') | NO | |N | |
| Insert_priv | enum('N','Y') | NO | |N | |
| Update_priv | enum('N','Y') | NO | |N | |
| Delete_priv | enum('N','Y') | NO | |N | |
| Create_priv | enum('N','Y') | NO | |N | |
| Drop_priv | enum('N','Y') | NO | |N | |
| Grant_priv | enum('N','Y') | NO | |N | |
| References_priv | enum('N','Y') | NO | |N | |
| Index_priv | enum('N','Y') | NO | |N | |
| Alter_priv | enum('N','Y') | NO | |N | |
| Create_tmp_table_priv | enum('N','Y') | NO | |N | |
| Lock_tables_priv | enum('N','Y') | NO | |N | |
| Create_view_priv | enum('N','Y') | NO | |N | |
| Show_view_priv | enum('N','Y') | NO | |N | |
| Create_routine_priv | enum('N','Y') | NO | |N | |
| Alter_routine_priv | enum('N','Y') | NO | |N | |
| Execute_priv | enum('N','Y') | NO | |N | |
| Event_priv | enum('N','Y') | NO | |N | |
| Trigger_priv | enum('N','Y') | NO | |N | |
+-----------------------+---------------+------+-----+---------+-------+
7. What is the field type and size of the field "user"?
User | char (32)
8. Create new database and name it "db_pis"
mysql> create database db_pis;
ERROR 1007 (HY000): Can't create database 'db_pis'; database exists
9. Create new database and name it "db_school"
mysql> create databases db_school;
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
'databases db_school' at line 1
10. Create new databse and name it "db_fores"
mysql> create database db_fores;
ERROR 1007 (HY000): Can't create database 'db_fores'; database exists
11. How many tables are available in database "db_school"?
mysql> describe db_school;
ERROR 1146 (42S02): Table 'mysql.db_school' doesn't exist
12. Remove the database "db_fores".
mysql> drop database db_fores;
Query OK, 0 rows affected (0.06 sec)
13. How many databases are available on your server?
22 rows in set (0.00 sec)
14. Create new database "db_pie"
mysql> create database db_pie;
ERROR 1007 (HY000): Can't create database 'db_pie'; database exists
15. Are there how many tables available in database "test"
3 rows in set (0.00 sec)
16. Display or identify the tables in the database "test"
mysql> show tables in db_test;
+-------------------+
| Tables_in_db_test |
+-------------------+
| tbcustomer |
| tbl_customer |
| tbl_orders |
+-------------------+

17. Create database "db_wolf"


mysql> create database db_wolf;
Query OK, 1 row affected (0.00 sec)
18. Remove or delete the database "db_fores"
mysql> delete db_fores;
19. Remove or delete the database "db_sore" (Please write the error message if any)
mysql> delete db_sore;
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
20. create database "db_name"
mysql> create database db_name;
Query OK, 1 row affected (0.00 sec)
21. How many databases do you have on your server?
24 rows in set (0.00 sec)

22. Identify the field type and size of the fieldname:password under the table:user of
database:mysql

23. Create new database: "db_fores"


mysql> create database db_fores;
Query OK, 1 row affected (0.00 sec)
24. Create new database: "db_fores" (if error occcured, what is the messsage?)
25. How many fields are there in table COLUMNS of database:information_schema
26. How many fields are there in the table host of database: mysql?
27. How many tables are there in the database: Northwind?
28. Remove or delete the database: "db_school"
mysql> delete db_school;
29. How many fields are there in table:orders of database:northwind?
30. Change/Modify the database:"db_pis" to "db_pisoc"
31. Create new database: "db_ford"
32. Identify the fields of table:"orders" of database:"Northwind"
33. Identify the number of databases currently available on your server.

***nothing follows......

You might also like