Syntax for DDL table design in MSSQLServer 2014.

AI Thread Summary
The discussion centers on learning Data Definition Language (DDL) for table design in Microsoft SQL Server 2014. Key questions include the proper order of attributes and constraints in a CREATE TABLE statement, with clarification sought on whether attributes and constraints can be interchanged without affecting functionality. The necessity of commas between attribute declarations and constraint statements is also questioned, along with the need for commas between consecutive constraints. Additionally, the discussion addresses how to identify referenced attributes in an Entity-Relationship Diagram (ERD), particularly when attribute names differ between entities. References to external resources, such as Stack Overflow and MSDN, are provided for further guidance on generating DDL and understanding syntax.
WWGD
Science Advisor
Homework Helper
Messages
7,699
Reaction score
12,690
Hi all, I am learning DDL ( as opposed to GUI ) table design in MSSL2014.

EDIT I am given a table printout and I want as an output the(a) DDL code that would output the given table.
Sorry, I don't have a scanner nor the original file in my PC, I have a table diagram in a piece of paper.

I have the following questions, please:

1) Is there a necessary order of attributes and constraints? Meaning, can I equally write:

Create Table 'Table Name' ( attribute1 datatype(attribute1) not null/null , attribute2 datatype(attribute2) not null/null , constraint1 ...)

than
Create Table 'Table Name' ( attribute1 datatype(attribute1) not null/null , constraint1..., attribute2 datatype(attribute2) not null/null , constraint1 ...)

2) Do I need a comma between the declaration of an attribute's properties and a constraint statement?

3)Do I need a comma to separate any two consecutive constraint statements? Or do I just write ...constraint ...
constraint... ?

4) Say I have an attribute, say, JobId, in a table 'Job' and this attribute is a Foreign Key . The constraint statement here is:

constraint [FK_Job] foreign key (JobID) references ...

Can I tell from an ERD (given graphically) which attribute is being referenced? Sometimes the attribute that is being referenced is given a different name within the entity to which the attribute is exported. Is there a way of seeing which other attribute is being referenced?
I will try to scan the ERD when I get a chance.
Thanks. Thanks.
 
Last edited:
Technology news on Phys.org
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top