Mysql
Mysql
Group No.1
• Kishore Vadlamudi
• Poojitha
• Thomala Swathi
• Maheshwari Subbara
• Nakka Vivek Kumar
• Maneesha
• Sharath Kumar
• Ketan
• Anshika Rai
• Abhishek
WHAT IS MYSQL
•MYSQL IS AN OPEN-SOURCE RELATIONAL DATABASE MANAGEMENT SYSTEM (RDBMS) THAT
STORES DATA IN ROWS AND COLUMNS. IT'S USED IN MANY INDUSTRIES, INCLUDING WEB
APPLICATIONS, B2B SERVICES, AND CUSTOMER-FACING APPLICATIONS.
•OPEN SOURCE
•ANYONE CAN USE, MODIFY, PUBLISH, AND EXPAND ON MYSQL. IT'S RELEASED UNDER THE GNU
GENERAL PUBLIC LICENSE (GPL).
•RELATIONAL DATABASE
•MYSQL STORES DATA IN SEPARATE TABLES AND DEFINES RELATIONSHIPS BETWEEN ROWS AND
COLUMNS IN SCHEMAS.
•SPEED AND RELIABILITY
•MYSQL IS KNOWN FOR ITS SPEED AND RELIABILITY.
•WIDE COMPATIBILITY
•MYSQL IS AVAILABLE ON OVER 20 PLATFORMS, INCLUDING LINUX, UNIX, WINDOWS, AND MAC.
•USED BY TOP WEBSITES
•MYSQL IS THE RDBMS BEHIND MANY OF THE TOP WEBSITES IN THE WORLD, INCLUDING
FACEBOOK, TWITTER, AND YOUTUBE.
OVERVIEW OF MYSQL AND ITS DATA TYPES
• MySQL is a database management system that uses SQL to interact with its database and
supports a variety of data types. These data types are used to store and retrieve different types
of data efficiently
Integer Types
• MySQL supports multiple integer types, including TINYINT, SMALLINT, MEDIUMINT, INT, and BIGINT. These
7
types differ in their storage size, range, and use cases. TINYINT is limited to 1 byte while BIGINT takes up 8
bytes. Understanding these differences helps in selecting the appropriate type for specific data needs.
Data Types Explained
Data Type Storage Size Value Range
-9,223,372,036,854,775,808 to
BIGINT 8 bytes
9,223,372,036,854,775,807
-1.7976931348623157E+308 to
DOUBLE 8 bytes
1.7976931348623157E+308
Application Needs
Performance Considerations
during computations.
PRACTICAL USE CASES
Real-World Applications
• Numeric data types support a wide array of real-world applications. For instance, TINYINT is
often used for flags or small numbers, while DECIMAL is vital in finance for accurate
calculations. Similarly, FLOAT and DOUBLE are perfect for scientific data where precision and
range are essential. Understanding these use cases allows developers to utilize the most
efficient data types for their specific applications.
Fixed point data types store numerical
values with a fixed number of decimal
places.
Precision:- The total number of digits (both before and after the decimal point).
Ex:- 1.234
Precision = 4
Scale = 3
DATE AND TIME DATA TYPES IN SQL
• Time Calculations: Ideal for operations involving • Date Comparisons: Suitable for filtering or
time calculations or comparisons, such as finding comparing records based on the year.
events that occur after a certain time.
How to Use: How to Use:
Definition: The time data types stores the time Definition: the Year data type stores year
values in the format HH:MM:SS values in either a 2-digit or 4-digit format.
Range: '-838:59:59’ to '838:59:59' Range: 1901 to 2155 (for 4-digit format) or 70
to 69 (for 2-digit format).
STRING DATA TYPES: CHAR, VARCHAR
STRING : STORE SEQUENCES OF CHARACTERS.
In MySQL that can store string-ish values, such as the BINARY and VARBINARY
columns. These store bytes of data rather than characters, allowing users to store raw
binary data, little bits of binary data that cannot be represented as strings, or do not need
to be stored in that way.
The BINARY column is a fixed length column, while the VARBINARY column is a variable
length column. With VARBINARY columns, you can store up to a set number of bytes, rather
than fixed data types. Although not too commonly used, BINARY and VARBINARY columns
provide an efficient way to store binary data .
BLOB DATA TYPES
•BLOB, OR BINARY LARGE OBJECT, IS A MYSQL DATA TYPE
THAT STORES BINARY DATA LIKE IMAGES, MULTIMEDIA, AND PDF
FILES. BLOB VALUES ARE TREATED AS BINARY STRINGS AND CAN BE
STORED IN RANDOM-ACCESS CHUNKS CALLED SBSPACES.
•TINYBLOB:
•BLOB:
•MEDIUMBLOB:
•LONGBLOB:
•
•EXAMPLES OF FILES STORED IN BLOB
•IMAGES (JPG, JPEG, PNG, GIF, HEIC, WEBP), VIDEOS (MP4, AVI, MOV,
MKV), AUDIO FILES (MP3, WAV, AAC), DOCUMENTS (PDF, TXT, CSV,
DOCX, XLSX), ARCHIVES (ZIP, RAR), EXECUTABLE FILES (EXE, MSI),
BACKUPS (SQL, BAK)
ENUM AND SET DATA TYPES
• ENUM and SET are string data types in MySQL that are used to define columns
that can only contain a set of values. Both types are defined using string values, but
MySQL stores them internally as integers.
• Here are some things to know about ENUM and SET data types in MySQL:
• Data validation
• ENUM and SET columns help ensure that only valid data is entered into a column.
• Readability
• ENUM and SET columns allow you to store readable values in your database.
• Compact data type
• ENUM and SET columns take up less storage space than other data types, such as
strings.
• When to use
• ENUM is useful when you have a fixed set of items that can be stored in the
column, such as days of the week or status flags.
• How to use
• When you insert data into an ENUM column, you can use the index number or the
corresponding string value to represent the value you want to store.
DATA TYPES IN MYSQL
•SQL data types define the type of value that can be stored in a table
column. For example, if you want a column to store only integer values,
you can define its data type as INT.
SQL data types can be broadly divided into the following categories.
1.Numeric data types such as: INT, TINYINT, BIGINT, FLOAT, REAL,
etc.
2.Date and Time data types such as: DATE, TIME, DATETIME, etc.
3.Character and String data types such as: CHAR, VARCHAR, TEXT, etc.
4.Unicode character string data types such as: NCHAR, NVARCHAR,
NTEXT, etc.
5.Binary data types such as: BINARY, VARBINARY, etc.
6.Miscellaneous data types - CLOB, BLOB, XML, CURSOR, TABLE, etc.