SQL Basics
SQL Basics
▪ Retrieving data
▪ Inserting data
▪ Updating data
▪ Deleting data
▪ Creating and modifying database structures
▪ Managing permissions
Database
• A Database is defined as a structured form of data storage in a computer
or a collection of data in an organized manner and can be accessed in various
ways.
• It is also the collection of schemas, tables, queries, views, etc.
• The Database Management System allows a user to interact with the database.
▪ DECIMAL(p,s): Used for precise numbers with decimal points where p (Precision) is the
total number of significant digits that can be stored, both to the left and right of the decimal
point and s (Scale) is the number of digits that can be stored to the right of the decimal
point.
E.g.-DECIMAL(5, 2) This can store numbers up to 129.29. The precision is 5 (total digits),
and the scale is 2 (digits after the decimal)
▪ CHAR(n): Fixed-length string. If the input is shorter than n, it’s padded with spaces.
E.g. – name CHAR(10)
Kanchan - 3 characters are space padding
Kavya - 5 characters are space padding
E.g. - The order status of any product can be one of the following: shipped,
delivered, cancelled, or pending. If you try to insert any other value into the order
status, it will throw an error.