0% found this document useful (0 votes)
18 views5 pages

Database Assignment Guidelines and Solutions

Uploaded by

ozibook.da
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views5 pages

Database Assignment Guidelines and Solutions

Uploaded by

ozibook.da
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

MODULE - 3

ASSIGNMENT

Please do not use GenAI (e.g. ChatGPT) for solving assignments and do not copy and paste
from the internet. Understand the solution using GenAI or the internet if you want to but you
have to answer in your own words. Also do not copy solutions from your friends or
batchmates.

Our plagiarism tool on LMS will identify such things and make a record that you are following
unethical means to solve assignments. Without any notice we shall just discard your name
from any internship or job assistance from our side.

Ethics is the number one quality which we all must possess. Thank You

Instructions:
Please share your answers filled in line in the Word document. Submit code
separately wherever applicable.

Please ensure you update all the details:


Name: Avinash Kumar Batch ID: 04/04/2025

Topic: Introduction to Database

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?

© 360DigiTMG. All Rights Reserved.


Answers

1. Create a database with a sales table containing data types like int,
varchar, char, date, time, timestamp, boolean, decimal, text

create database classroom;


use classroom;
create table sales (
sale_id int,
customer_name varchar(50),
product_code char(5),
sale_date date,
sale_time time,
sale_timestamp timestamp,
is_paid boolean,
amount decimal(10,2),
notes text
);

© 360DigiTMG. All Rights Reserved.


2. Insert 10 random values in the table

insert into sales values


(1, 'Ravi Kumar', 'P1001', '2024-06-12', '[Link]', current_timestamp, true,
1250.50, 'purchased mobile phone'),
(2, 'Sneha Patil', 'P1002', '2024-06-13', '[Link]', current_timestamp, false,
300.00, 'pending payment for headphones'),
(3, 'Amit Sharma', 'P1003', '2024-06-14', '[Link]', current_timestamp, true,
999.99, 'laptop accessory paid in cash'),
(4, 'Kiran Rao', 'P1004', '2024-06-15', '[Link]', current_timestamp, true,
2500.00, 'home appliance with discount'),
(5, 'Meena Gupta', 'P1005', '2024-06-16', '[Link]', current_timestamp,
false, 600.75, 'order placed, EMI pending'),
(6, 'Vikas Singh', 'P1006', '2024-06-17', '[Link]', current_timestamp, true,
350.40, 'grocery purchase via UPI'),
(7, 'Pooja Verma', 'P1007', '2024-06-18', '[Link]', current_timestamp, true,
4500.00, 'premium furniture order'),
(8, 'Ramesh Iyer', 'P1008', '2024-06-19', '[Link]', current_timestamp,
false, 799.00, 'order placed but not delivered'),
(9, 'Anjali Desai', 'P1009', '2024-06-20', '[Link]', current_timestamp, true,
100.50, 'trial cosmetics order'),
(10,'Sanjay Nair', 'P1010', '2024-06-21', '[Link]', current_timestamp, true,
2200.00, 'return requested for smartwatch');

3) Change the data type of the existing column from decimal(10,2) to float

alter table sales


modify column amount float;

© 360DigiTMG. All Rights Reserved.


4) Change the data type of the existing column from text to varchar

alter table sales


modify column notes varchar(255);

5. What is “BLOB” Data Type in SQL, what are different types of BLOB?
A BLOB (Binary Large Object) is a data type used to store binary data like
images, audio, or video files. It allows storing large unstructured objects in a
database.
Types of BLOB in SQL:
TINYBLOB – very small binary objects (up to 255 bytes).
BLOB – normal binary objects (up to 65 KB).
MEDIUMBLOB – medium binary objects (up to 16 MB).
LONGBLOB – very large binary objects (up to 4 GB).

6. Write different character data types and different numerical data types

Character Data Types:


Char, varchar, text, tinytext, mediumtext, longtext

Numerical Data Types:


int, smallint, bigint, decimal(p,s), float, double

© 360DigiTMG. All Rights Reserved.


© 360DigiTMG. All Rights Reserved.

You might also like