ago
39 views
0 0 votes

Consider,

Universities(
    name TEXT,
    abbrev CHAR(3),
    addr TEXT,
    zip CHAR(5),
    phone TEXT,
    enrolled INTEGER
)

Assume,

  • record header = $4$ bytes,
     
  • integer = $4$ bytes,
     
  • a $\mathrm{TEXT}$ field may be empty,
     
  • $\mathrm{CHAR}(n)$ always occupies exactly $n$ bytes.
     

What is the smallest possible record size, in bytes?

1 Answer

0 0 votes

For the minimum-size record, all three $\mathrm{TEXT}$ fields can contain empty strings:

$\mathrm{name}=0\mathrm{\ bytes}$

$\mathrm{addr}=0\mathrm{\ bytes}$

$\mathrm{phone}=0\mathrm{\ bytes}$

The remaining storage is:

$\mathrm{header}=4$

$\mathrm{abbrev}=3$

$\mathrm{zip}=5$

$\mathrm{enrolled}=4$

Therefore,

$4+3+5+4=16$

Hence,

Answer : $\boxed{16\mathrm{\ bytes}}$

This is a useful distinction from fixed-length records. 

A variable-length attribute's maximum declared length is not necessarily the amount of storage actually occupied by every record.

ago
Answer:
Position:
Show:

Related questions

0 0 votes
1 1 answer
38
38 views
GO Classes asked 2 days ago
38 views
Which of the following are benefits of using a record header for variable-length records?Delimiter characters between fields are not required. It always uses equal or les...
0 0 votes
1 1 answer
39
39 views
GO Classes asked 2 days ago
39 views
Consider:CREATE TABLE products ( id INTEGER PRIMARY KEY, stock INTEGER NOT NULL, price INTEGER NOT NULL, name VARCHAR(10) NOT NULL, category CHAR(6) NOT NULL, serial_numb...
1 1 vote
1 1 answer
41
41 views
GO Classes asked 2 days ago
41 views
Consider the following statement:In fixed-length records, a character field of type $\mathrm{CHAR}$ is not allowed.Enter $1$ if the statement is true and $0$ if it is fal...
2 2 votes
1 1 answer
98
98 views
GO Classes asked 2 days ago
98 views
Consider,CREATE TABLE zoomers ( lecture_id INTEGER PRIMARY KEY, week INTEGER NOT NULL, topic VARCHAR(30) NOT NULL, num_thanks INTEGER, poppin_chat BOOLEAN );Assume,intege...