Presentation is loading. Please wait.

Presentation is loading. Please wait.

Representing Data Elements Gayatri Gopalakrishnan.

Similar presentations

Presentation on theme: "Representing Data Elements Gayatri Gopalakrishnan."— Presentation transcript:

1 Representing Data Elements Gayatri Gopalakrishnan

2 Contents Representing Relational Database Elements Representing Objects Representing Data Elements Records Reference

3 Representing Relational Database Objects CREATE TABLE StudentDetail( name CHAR(35), studentid INT(6) PRIMARY KEY, dept VARCHAR(50) );

4 Object as a Tuple How are an Object’s Methods stored Object Identifiers Accessing Methods Relation between objects Representing Objects

5 Representing Data Elements Character Data types Bit Strings Enumerated Types Integer and Float Dates and Times

6 Character Strings Fixed Length Character strings Described by SQL as CHAR (n), stored as an array of n bytes If actual string < n, the array is filled out with pad characters Default minimum size 1 byte maximum size 2000 bytes

7 Variable Length Character Strings Described by SQL as VARCHAR(n) Stored as an array of n+1 bytes Default minimum size 1 byte maximum size 4000 bytes Two representations of VARCHAR strings  Length plus content  Null Terminated string Character Strings contd..

8 Bits Described by SQL as BIT(n) If n is not divisible by 8, ignore the unused bits of the last byte Enumerated Types Attributes whose values take on a small fixed set of values Example Color = {RED,BLUE,GREEN,YELLOW}

9 Integer and Floats Integer Described by SQL as INTEGER Float Described by SQL as DECIMAL(p,s) p is the precision s is the scale Date and Time Date is represented as a fixed length character string Format 1948-05-14

10 Date and Time contd.. Time is represented as a character string SQL standard allows value of TIME to include fractions of second – This can represented as VARCHAR or variable length values Time with time zone example 12:00:00-4.5 TIMESTAMP example 1948-05-14-12:00:00.000000 Timestamp can also include time zone

11 Thank You

Download ppt "Representing Data Elements Gayatri Gopalakrishnan."

Similar presentations

Ads by Google