Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Syntax for DDL table design in MSSQLServer 2014.

Tags:
  1. Nov 29, 2015 #1

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    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: Nov 29, 2015
  2. jcsd
  3. Dec 1, 2015 #2

    jedishrfu

    Staff: Mentor

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Syntax for DDL table design in MSSQLServer 2014.
Loading...