You want to create a new table in the USER_DTAB tablespace. The table, named CH0
ID: 3716441 • Letter: Y
Question
You want to create a new table in the USER_DTAB tablespace. The table, named CH07GOLD, stores a history of the price of gold. A new row is added to the table approximately every two hours. Write the CREATE TABLE command for the table. Your command should address these points:
? The columns are named PRICE, PRICE_DATETIME, and TIME_BETWEEN.
? The PRICE can contain fractions of a penny as small as thousandths of a penny. The price is always under 1000 dollars.
? The TIME_BETWEEN column stores the number of days (up to 99 days), hours, minutes, and seconds (to the hundredth of a second) between this record and the previous record.
? Because the table is always receiving inserted data and is never updated, you want to minimize the storage space saved for updates.
? Assume that the average row length is 20 bytes, the table gets an average of 12 inserted records per day, and you want the table to be created with enough storage space for approximately 6 months. Do not run the command in your database, because you do not have any dictionarymanaged tablespaces, which this command requires. Save your command in a file named ho0704.sql in the SolutionsChapter07 directory on your student disk.
Explanation / Answer
Below is the create statement for creating the given table. Appropriate data type is used for storing the values and also to keep the storage as minimal as possible.
// To use the database
USE USER_DTAB;
// Creating table.
CREATE TABLE CH07GOLD
(
PRICE DECIMAL(4,4),
PRICE_DATETIME DATETIME,
TIME_BETWEEN TINYINT
);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.