1 / 3

Basic SQL types

Basic SQL types. String Char(n): fixed length. Padded Varchar(n): variable length Number Integer: 32 bit Decimal(5,2): 999.99 Real, Double: 32 bit, 64 bit Datetime Date: ‘2002-01-15’ Time: ’13:40:00’ Timestamp: ‘2002-01-15 13:40:00’. Schema definition (table creation).

ghada
Download Presentation

Basic SQL types

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basic SQL types • String • Char(n): fixed length. Padded • Varchar(n): variable length • Number • Integer: 32 bit • Decimal(5,2): 999.99 • Real, Double: 32 bit, 64 bit • Datetime • Date: ‘2002-01-15’ • Time: ’13:40:00’ • Timestamp: ‘2002-01-15 13:40:00’

  2. Schema definition (table creation) Course(dept,cnum,sec,unit,instructor,title) CREATE TABLE Course ( dept CHAR(2) NOT NULL, cnum INTEGER NOT NULL, sec INTEGER NOT NULL, unit INTEGER, instructor VARCHAR(30), title VARCHAR(30), PRIMARY KEY(dept, cnum, sec) )

  3. Schema definition (table creation) Course(dept,cnum,sec,unit,instructor,title) Course(dept,cnum,sec,unit,instructor,title) Course(dept,cnum,sec,unit,instructor,title) CREATE TABLE Course ( dept CHAR(2) NOT NULL DEFAULT ‘CS’, cnum INTEGER NOT NULL, sec INTEGER NOT NULL, unit INTEGER, instructor VARCHAR(30), title VARCHAR(30) DEFAULT, PRIMARY KEY(dept, cnum, sec) UNIQUE(dept, cnum, instructor), UNIQUE(dept, sec, title) )

More Related