131k views
3 votes
Using MARIA DB

SUMBIT CODE AND SCREENSHOT
1.Create a database named 'mydatabase'.
2. Within 'mydatabase', create a table named 'mytable' with the following columns: id set to integer of 2 characters, name set to varchar of 10 characters, and age set to integer of 2 characters.
3. Create a user named 'myuser' with password set to 'mypass'.
4. Grant 'myuser' with all the privileges to only mytable from mydatabase.
5. Create a view named 'myview' for 'mytable' that only queries the the columns 'id' and 'age'.
6. Insert the following information into 'mytable': 1, ricky bobby, 32
7. Display all the columns in 'myview'.
8. Insert the following information into 'mytable' in the name column: Ricky Bobby.
9. In 'mytable', set id equal 2 where name is equal to 'Ricky Bobby'
10. Delete 'mytable' from 'mydatabase'.

1 Answer

5 votes

Final answer:

The student's question pertains to completing various database operations in MariaDB, including creating databases and tables, managing users and permissions, working with views, and manipulating table data.

Step-by-step explanation:

The question asks about various operations in MariaDB, a popular open-source database management system. The tasks include creating databases, tables, users, views, inserting data, and manipulating permissions and data within the table.

Steps to complete the tasks:

Create a database named 'mydatabase'.

Create a table named 'mytable' with specific columns and data types.

Create a user 'myuser' with a password.

Grant the user 'myuser' privileges on 'mytable'.

Create a view 'myview' that includes only the 'id' and 'age' columns.

Insert rows into 'mytable'.

Display the content of 'myview'.

Update 'mytable' by inserting or updating the 'name' column.

Delete 'mytable' from 'mydatabase' after manipulation.

Note: The length specification for the integer datatype is not standard SQL and typically applies to display width in MySQL or MariaDB rather than storage size. The exact commands to perform these operations in MariaDB involve using SQL statements like CREATE DATABASE, CREATE TABLE, CREATE USER, GRANT, CREATE VIEW, INSERT, SELECT, UPDATE, and DROP TABLE.

User Artur Owczarek
by
8.6k points