Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| modul:m290:learningunits:lu06:aufgaben:a01 [2024/10/22 13:05] – vdemir | modul:m290:learningunits:lu06:aufgaben:a01 [2024/10/29 11:55] (aktuell) – vdemir | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | ====== LU09.A01 - SQL- DCL: CREATE User - Under construction | + | ====== LU09.A01 - SQL- DCL: |
| + | It is high time to mess a litte around with our new SQL powers, don't you think? So, let's try it directly on our Webstorm. | ||
| + | |||
| + | As the database administrator, | ||
| ===== Requirements | ===== Requirements | ||
| * Work type: individual | * Work type: individual | ||
| - | * Timeframe: | + | * Timeframe: |
| * Means of aid: | * Means of aid: | ||
| * only teaching materials, no websearch, no use of ai. | * only teaching materials, no websearch, no use of ai. | ||
| * Webstorm with connection to the MySQL-DB | * Webstorm with connection to the MySQL-DB | ||
| - | * Expected result: | + | * Expected result: |
| - | + | ||
| - | It is high time to mess a litte around with our new SQL powers, don't you think. So let's try it directly on our Webstorm. | + | |
| ===== Case studies / Assignments ===== | ===== Case studies / Assignments ===== | ||
| + | Before we spend elbow grease, we need to prepare our working enviroment. Meaning we need to prepare our computer for the assignments later. | ||
| + | |||
| + | ==== Task 1.1 ==== | ||
| + | **Login as root**: Login in from Webstorm to your database as //root// (sysdba = systemadministrator for the datababase) with your a // | ||
| - | ==== Task A ==== | + | ==== Task 1.2 ==== |
| - | **Create the User**: Create a user named //restrictedUser// | + | **New Database**: Create a new database |
| - | ==== Task B ==== | + | CREATE DATABASE myDatabase; |
| - | **Grant Privileges Without Table Management**: | + | |
| - | ==== Task C ==== | + | ==== Task 1.3 ==== |
| - | **Rovoke Privileges**: To be certain | + | **use db**: Use that newly created db. |
| - | ==== Tasc D ==== | + | USE myDatabase; |
| - | **View the User’s Privileges**: | + | |
| - | ==== Task E ==== | + | ==== Task 1.4: ==== |
| - | **Test the User’s Access**: Connect as //restrictedUser// and try to perform a CREATE TABLE or DROP TABLE operation. The attempt should result in a permission error. | + | ** Create a test table**: Create a table //users// with 3 columns of your choice as a test table. |
| - | ==== Task F ==== | + | CREATE TABLE users ( |
| - | **Delete the User (optional)**: After testing, you can delete | + | user_id INT AUTO_INCREMENT PRIMARY KEY, |
| + | username VARCHAR(50) NOT NULL, | ||
| + | email VARCHAR(100) NOT NULL | ||
| + | ); | ||
| + | |||
| + | ==== Task 1.5: ==== | ||
| + | **Content data for testing:** Fill the table user with some test data: | ||
| + | |||
| + | INSERT INTO users (username, email) | ||
| + | VALUES | ||
| + | (' | ||
| + | (' | ||
| + | (' | ||
| + | (' | ||
| + | (' | ||
| + | (' | ||
| + | (' | ||
| + | (' | ||
| + | (' | ||
| ===== Solution ===== | ===== Solution ===== | ||