Generation

text to sql syntaxTue, 24 Jan 2023

Erstelle eine Tabelle mit 5 spalten, primarykey, titel, Produktionsjahr, IMDb Nummer, IDs Der darsteller. Erstelle eine zweite Tabelle Darsteller mit primarykey, darstellerid und Darstellername. Doppelte Wert in Darstellername ist nicht erlaubt. Erstelle eine Abfrage des Darstellernamens per ID der Darsteller aus Tabelle 1 zu Tabelle 2 Erstelle eine Abfrage in Tabelle Darsteller mit alle doppelten Darstellername

CREATE TABLE movies ( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, title VARCHAR(30) NOT NULL, year INT(4) NOT NULL, imdb VARCHAR(15) NOT NULL, actor_id INT(15) ); CREATE TABLE actors ( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, name VARCHAR(30) NOT NULL UNIQUE, actor_id INT(15) ); SELECT * FROM actors JOIN movies ON actors.id = movies.actor_id; SELECT name FROM actors GROUP BY name HAVING COUNT(name) > 1;

Questions about programming?Chat with your personal AI assistant