Professional Documents
Culture Documents
Assignment 04 Answers
Assignment 04 Answers
Assignment 04 Answers
Data types
Instructions:
Please share your answers filled in line in the Word document. Submit code
separately wherever applicable.
1. Create a database with a sales table containing data types like int,
varchar, char ,date, time, timestamp, Boolean, decimal, text ?
2. Insert 10 random values in the table ?
3. Change the data type of the existing column from DECIMAL (10,2) to
FLOAT ?
4. Change the data type of the existing column from Text to Varchar?
5. What is “BLOB” Data Type in SQL, what are different types of BLOB?
6. Write different character data types and different numerical data types?
ANSWERS:
Certainly! Below are SQL queries that perform the tasks you've mentioned:
```sql
### 3. Change the data type of the existing column from DECIMAL (10,2) to
FLOAT:
```sql
-- Change data type from DECIMAL(10,2) to FLOAT
ALTER TABLE sales
MODIFY COLUMN price FLOAT;
```
### 4. Change the data type of the existing column from Text to Varchar:
```sql
© 360DigiTMG. All Rights Reserved.
Assignment:- 04
Data types
-- Change data type from TEXT to VARCHAR
ALTER TABLE sales
MODIFY COLUMN product_description VARCHAR(255);
```
- **BLOB (Binary Large Object):** It is a data type for storing binary data, such
as images, audio, or other multimedia objects.
- **Types of BLOB:**
- **TINYBLOB:** Up to 255 bytes
- **BLOB:** Up to 65,535 bytes
- **MEDIUMBLOB:** Up to 16,777,215 bytes
- **LONGBLOB:** Up to 4 GB