Dies ist eine alte Version des Dokuments!
LU03.L01 - Choose data-types
Task a) Choose datatypes
Which datatype would you use to store the following information? Give reason for your decision.
- product-title like trousers up to 50 characters:
- VARCHAR(50)
- Titles can be at the most 50 characters. A fix length makes not sense in that case.
- product-description up to 255 characters:
- VARCHAR(255)
- The description can be 255 characters, but can also be shorter. A fix length does not make sense in that case.
- stock amount:
- INT or INTEGER
- Floating point type is not suitable as pieces are always counted in whole numbers.
- price of each piece:
- Prices have floating point
- The data-type FLOAT (5,2) should be sufficient enough as trousers are usually within a price ranger of 0.99 to 999.99.
- order date:
- date of delivery:
- whether organical or not:
- usage category with only one character: