A database is a collection of data that is organized in a manner that facilitates ease of access, as well as efficient management and updating.
A database is made up of tables that store relevant information.
For example, you would use a database, if you were to create a website like PHPGurukul which contains lots of information like videos, usernames, passwords, and comments.
A table stores and display data in a structured format consisting of columns and rows that are similar to those in an Excel spreadsheet.
Databases often contain multiple tables, each designed for a specific purpose. For example, creating a database table of names and mobile numbers.
First, we would set up columns with titles firstName, lastName, and mobileNumber. Each table includes its own set of fields, based on the data it will store.
A table has a specified number of columns but can have any number of rows.
A Primary Key is a field in the table that uniquely identifies the table record.
The primary key’s features:
- It must contain a unique value for each row.
- It cannot contain NULL values.
For example, our table contains a record of each name in the phone book. The unique id number would be a good choice for a primary key in the table, as there is always the chance for more than one person to have the same name
Tables are limited to one primary key each.
The primary key's value must be different for each row.
What is SQL?
SQL stands for Structured Query Language.
SQL is used to access and manipulate a database.
- Insert, update, or delete records in a database.
- Create new databases, tables, stored procedures, and views
- retrieve data from a database, etc