suppose i want to create a table name ABC using DDL queries… in this table we have a column named as month.. i want that values of month should integer between 1 and 12 only? can u plz help me how to write a DDL query for this in MS-Access?
Sir Can you check if my answer to this question is right pls Write a single SQL statement to create a new table named Login with five columns: Username(Text), Password(Text) LastUpdate(Date) Status(Text) and CustomerID(Interger)
Assign Username as the primary key of the table The Password should never be NULL Set the default value of LastUpdate to the current date and time (Aust Time) Define a check on Status to make sure the value could either be active or inactive Assign CustomerID as a foreign key referencing the Customer table
ANSWER CREATE TABLE Login (Username TEXT PRIMARY KEY NOT NULL, Password TEXT NOT NULL, Last Update DATETIME DEFAULT GETDATE (NZTIME), Status TEXT CHECK (Status = "active" OR Status = "inactive"), FOREIGN KEY (CustomerID) REFERENCE Customer (CustomerID) ON DELETE NO ACTION ON UPDATE NO ACTION )
21 responses to “SQL Tutorial – 9: Create Table Statement”
accha h bt language me thodi problem h
so …thaku for that
Sir … What is this application software
Thanks a lot man, you made it very simple!
Ratahe kya kya bol rage ho
where are u doing this on which database
suppose i want to create a table name ABC using DDL queries… in this table we have a column named as month.. i want that values of month should integer between 1 and 12 only? can u plz help me how to write a DDL query for this in MS-Access?
thank you
How do you specify Auto Increment and also collate charset etc?
Is it case sensitive language?
https://youtu.be/akqPIhFD9Ro
what software
which software is it?
I wrote datatypes in uppercase then compilation told that table not formed ,but in lowercase it formed ,Why?you told that they are not case sensitive
Still unclear
We need a clear practice
The concept of primary key must be taught first then all these…
Thank you so much for sharing it.
Thanks for video bt I also want Oracle and java core,advance full video pls help me sir
Thank you for posting the video, I appreciate it.
plz tell me why ID field can not hold NULL values…in video at time 7:00
Sir Can you check if my answer to this question is right pls
Write a single SQL statement to create a new table named Login with five columns: Username(Text), Password(Text) LastUpdate(Date) Status(Text) and CustomerID(Interger)
Assign Username as the primary key of the table
The Password should never be NULL
Set the default value of LastUpdate to the current date and time (Aust Time)
Define a check on Status to make sure the value could either be active or inactive
Assign CustomerID as a foreign key referencing the Customer table
ANSWER
CREATE TABLE Login
(Username TEXT PRIMARY KEY NOT NULL,
Password TEXT NOT NULL,
Last Update DATETIME DEFAULT GETDATE (NZTIME),
Status TEXT CHECK (Status = "active" OR Status = "inactive"),
FOREIGN KEY (CustomerID) REFERENCE Customer (CustomerID) ON DELETE NO ACTION ON UPDATE NO ACTION
)
though the output is executing correctly, there are red cross symbols against the steps written in the workbench.Can u pls clarify on the same ?