Answer the question
In order to leave comments, you need to log in
How can I parse this SQL query?
Good day.
I want to say right away that in SQL I don’t know more than basic things (such as SELECT, MAKE TABLE, WHERE, joining tables, etc.).
But still, there is the following task:
The FAKULTY attribute is a foreign key to the FACULTIES table, with ID as the primary key. Restore the foreign key setup order.
CREATE TABLE STUDENTS
( ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
NAME TEXT NOT NULL,
COURSE INTEGER NOT NULL,
FAKULTY INTEGER NOT NULL,
//установка внешнего ключа)
KEY, (ID), REFERENCE, FACULTIES, FOREIGN, (FACULTY)
FOREIGN KEY (FAKULTY) REFERENCES FACULTIES (ID)
, but the problem is that I don't understand what this piece of code does. I would be very grateful if you could explain to me. Answer the question
In order to leave comments, you need to log in
This is done very simply:
CREATE TABLE STUDENTS
( ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
NAME TEXT NOT NULL,
COURSE INTEGER NOT NULL,
FAKULTY INTEGER NOT NULL,
CONSTRAINT FK_FacultyStudent FOREIGN KEY (FAKULTY)
REFERENCES FACULTIES (ID)
CONSTRAINT FK_FacultyStudent FOREIGN KEY (FAKULTY)
REFERENCES FACULTIES (ID)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question