[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

table definitions example?

Posted on 2011-05-04
2
Medium Priority
?
452 Views
Last Modified: 2012-05-11
think this one should be some easy points - can anyone exaplain and show me an example of what the phase 'table definitions' mean?

Is it field name, size and type in the table? or is that field definition
0
Comment
Question by:MrDavidThorn
2 Comments
 
LVL 4

Expert Comment

by:qasim_md
ID: 35688637
SQL Table Definition is:

Table SQL preview

You can see the SQL representation of your table, it includes columns, indexes, foreign keys, etc.
0
 
LVL 23

Accepted Solution

by:
OP_Zaharin earned 1000 total points
ID: 35715003
- table definition describes a table structure in a database which consist of column name, datatype, length, etc.

- a table definition commonly describes the tablename, column definition: [column name] [data type] {NULL | NOT NULL} {column options}, primary key definition: PRIMARY KEY ( [comma separated column list] ) and CONSTRAINTS: {CONSTRAINT} [constraint definition]. eg of a table definition in Oracle is as follows:

-- Start of DDL Script for Table SCOTT.EMP
-- Generated 8-May-2011 16:31:46 from SCOTT@ORCL

CREATE TABLE emp
    (empno                          NUMBER(4,0) NOT NULL,
    ename                          VARCHAR2(10),
    job                            VARCHAR2(9),
    mgr                            NUMBER(4,0),
    hiredate                       DATE,
    sal                            NUMBER(7,2),
    comm                           NUMBER(7,2),
    deptno                         NUMBER(2,0))
  PCTFREE     10
  INITRANS    1
  MAXTRANS    255
  TABLESPACE  users
  STORAGE   (
    INITIAL     65536
    MINEXTENTS  1
    MAXEXTENTS  2147483645
  )
/


-- Constraints for EMP

ALTER TABLE emp
ADD CONSTRAINT pk_emp PRIMARY KEY (empno)
USING INDEX
  PCTFREE     10
  INITRANS    2
  MAXTRANS    255
  TABLESPACE  users
  STORAGE   (
    INITIAL     65536
    MINEXTENTS  1
    MAXEXTENTS  2147483645
  )
/

-- End of DDL Script for Table SCOTT.EMP

-- Foreign Key
ALTER TABLE emp
ADD CONSTRAINT fk_deptno FOREIGN KEY (deptno)
REFERENCES dept (deptno)
/
-- End of DDL script for Foreign Key(s

Open in new window

)



- using SQL query is one of a method to display the table definition. almost all SQL editor/database tools nowadays provide DDL (Data Dictionary Language) feature to ease the extraction of a table definition.

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question