sql1
sql1
use databases
WHAT IS DATA.
Data is information.
For example, your name, age, the songs in your playlist, or even the score
of a game you played.
A data about a student may include information like name, unique id, age,
address, education, etc.
DATABASE
Any collection of related information
what I am sharing is the absolute most general definition of this word, it is just
any collection of related information/data, so that could be something like
phonebook,shopping list, library, facebook userbase etc.
all of these are examples of databases.
all these are collections of information that store related stuff right..
So The phone book:it stores peoples phone numbers..their names and phone
nos ..its a collection of related data..
The best analogy is the library. The library contains a huge collection of books of
different genres, here library is database and books are the data.
Let us also consider Facebook. It needs to store, manipulate, and present data
related to members, their friends, member activities, messages, advertisements,
and a lot more. We can provide a countless number of examples for the usage of
databases.
• Examples:
• Telephone directory
• Customer data
• Product inventory
• Visitors’ register
• Weather records
In simple words, we can say a database in a place where the data is stored.
Data is basically information that exists in a variety of forms.
A database is a systematic collection of data.
So that really , in essence is everything you need to know about databases to get
started..its a collection of related data/information that can be stored in different
ways
So now that we understand the general definition
Now we are talking about how can we create databases on the computers
So lets talk about how can we go about creating databases on a computer
Now a database could be as simple as like a text file where you store informatiion
or it could be like a excel file right??
but generally if you are going to be using a database with an application or you
Are going to be using a database to store huge amounts of information a lot of
times, what people will do is they ill use special software which is designed to help
you create and maintain databases
This is called database management system..
so a database management system is a special software program that helps users
to create and maintain databases on a computer so it makes really easy for us to
manage lasrge amounts of information..
for example.. in company like amazon there are trillions of pieces of information
that need to keeep track of,,,well database management system can make it
pretty easy to store trillions of information.
Its not like all information is just like in a single text file
Dbms can also handle security, so they can make it so only certain people with the
username and passwords can access data
It will also help you to backup your data and import and export data from other
sources…so if you have a bunch of information and you want to backit upa
database mngmnt system can help you to do that
It can also interact with software application..
for eg..amazon.com is a website and it is interacting with amazon database which
is stored most likely using a database mnmngt system…so you could write a
program that could interact with database mnmnt system
All right soo.. just lets take a look at this quick little diagram that I have here
So we have amzon over here..an this would be like amazon.com..and amazon is
communicating with a database management system…so for the most part this is
the general use case
…so we have our database mnmnt system which is this little box here and the
databasemngnt system is creating and storing and keeping track of a database
so lets talk about crud: this is an acronym.. it stand sfor create read upadte and delete
ypu will also hear people call this create retrieve update and delete
now crud represents 4 main operations that we are going to be doing with the databases
so creating new dtaabase entries…you are going to be reading entries from database..so you know
retrieving or getting information that you already stored I database
these are the core 4 operations that we want the database management system to perform for us
So a relational database which we hve over here on the left, organizes data in one or more tables
So each table has columns and rows and a unique key identifies each row…now the relational databases
are by far the most popular types of databases and it store everything inside these tables only… s
And over there right we have non relational databases… a non relational databaes is basically just any
type of database that is not a relational database…and it I very general..so you have things like key value
pairs….so its anything that is not relational
So here I have a student table that might store details of individual students.. so you will see here we
have an id,name,and a major and you may notic here that im giving each of these students an ID and
this ID will be used to uniquely identify that row in the table
So when we want to create a relational database, we can use relational database management system or
an RDBMS
It is just a database mngmnt sytsem that helps you to create and maintain reational database and
some of the most popular are mysql,oracle, etc,,,
And relational database management systems use something called Structured Query language or sql
So inorder to interact with database we need a language that is sql
SQL Is a standardized language for interacting with relational database management system.. so if we
want to ask a relational database management system to do something for us ,,for example like to
create a table or store a data, delete a data then we can ask the relational management system to do
that using SQL
So SQL is the language that we can use to communicate with the database management system
SQL is a language that helps us talk to databases. It's like a special language we use to ask questions or
give instructions to a database.
1. Asking Questions: We can ask the database to give us specific information, like "Show me all
the names of the students" or "Tell me the total sales for last month." It helps us find the data
we need.
2. Adding, Changing, or Deleting Data: We can tell the database to add new data, update existing
data, or remove data we don't need anymore. For example, we can add a new customer's
information, change their address, or delete a product from the inventory.
3. Creating and Managing Databases: SQL allows us to create a database from scratch, define
how the data should be organized in tables, and establish relationships between tables. We
can also make changes to the database structure if needed.
sqlCopy code
Student Table : | ID | Name | Age | Grade | |----|----------|-----|-------| | 1 | John | 15 | 9 |
| 2 | Sarah | 16 | 10 | | 3 | Michael | 14 | 8 | | 4 | Emily | 15 | 9 |
In this table, we have four rows, each representing a different student, and
the columns hold specific information about the students.
The first column, "ID," represents a unique identifier for each student.
The second column, "Name," stores the names of the students.
The third column, "Age," contains the ages of the students.
The fourth column, "Grade," stores the grade levels of the students.
Each row represents a different student, and the data in each column
corresponds to the specific student's information. For example, in the first
row, the student's ID is 1, their name is John, they are 15 years old, and they
are in the 9th grade.
This table provides a simple way to organize and store student information in
a database.
I hope this example helps illustrate how a table is used to store data in a
structured manner. If you have any further questions, feel free to ask!
he table represents student information, and each column in the table
represents a specific attribute or category of information. Here's a
breakdown of the terms using the student table:
1 John 15 Science
To summarize:
I hope this explanation clarifies the concepts of fields, rows, and columns in
the context of a table. Let me know if you have any more questions!