Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Nächste Überarbeitung
Vorhergehende Überarbeitung
modul:m290:learningunits:lu05:aufgaben:03 [2024/09/16 15:05] – angelegt vdemirmodul:m290:learningunits:lu05:aufgaben:03 [2024/10/17 12:42] (aktuell) vdemir
Zeile 1: Zeile 1:
-====== LU06.A03 - SQL-DDL: Managing Table Constraints - Under Construction ======+====== LU07.A03 - SQL-DDL: Constraint Management ======
  
 ===== Requirements  ===== ===== Requirements  =====
   * Work type: individual   * Work type: individual
-  * Timeframe: .. Minutes+  * Timeframe: 30 Minutes
   * Means of aid:    * Means of aid: 
-      * only teaching materials, no websearch, no use of ai.+      * Only teaching materials, no websearch, no use of ai.
       * [[https://www.w3schools.com/sql/trysql.asp?filename=trysql_select_columns | W3Schools | SQL Editor]]       * [[https://www.w3schools.com/sql/trysql.asp?filename=trysql_select_columns | W3Schools | SQL Editor]]
-  * Expected result: Semsntically and syntactically correct SQL statements according to the requirements of the case studies. +  * Expected result: Semantically and syntactically correct SQL statements according to the requirements of the case studies. 
  
 ===== Case studies / Assignments ===== ===== Case studies / Assignments =====
-...+Here are five assignments, each covering a specific MySQL constraintAs usual, along with the solutions at the end (link).
  
 ===== Assignments ===== ===== Assignments =====
  
-  * a) ... +==== A: PRIMARY KEY ==== 
-  * b) ...+Create table books that has a book_id as a unique identifier for each book, with book_id as the primary key. Include columns for book_title (VARCHAR) and author_name (VARCHAR). The book_id should be an integer and cannot be NULL. 
 + 
 +==== B: AUTO INCREMENT ==== 
 +Create a table products where each product has an automatically generated, unique product_id using the AUTO_INCREMENT feature. Include columns for product_name and price
 + 
 +==== C: NOT NULL ==== 
 +Create a table students that includes a student_id (INT) and a student_name (VARCHAR). Ensure that the student_name column cannot have a NULL value by applying the NOT NULL constraint. 
 + 
 +==== D: UNIQUE ==== 
 +Create a table users that has a user_id (INT) and email (VARCHAR). Ensure that no two users can have the same email address by applying the UNIQUE constraint to the email column.  
 + 
 +==== E: FOREIGN KEY ==== 
 +Create two tables: one called departments and the other called employees. Each department has a department_id as its primary key. In the employees table, include a column called department_id as a foreign key that references the departments table. Ensure that every employee is linked to a department.
      
 ===== Solution ===== ===== Solution =====
-[[modul:m290:learningunits:lu06:loesungen:l01|Lösung]]+[[modul:m290:learningunits:lu05:loesungen:l03|Lösung]]
  
  
  • modul/m290/learningunits/lu05/aufgaben/03.1726491944.txt.gz
  • Zuletzt geändert: 2024/09/16 15:05
  • von vdemir