This Whole world is running because of data and its increasing at an exponential rate. You have data around you everywhere and all the time. Even your personal stuff is your data to use your stuff in better way it needs to be organized well so that they can be found out easily. And this is where a DMBS ( Data Base Management System) Comes in. They do the job of organizing your data.

Now I hope everyone understand that computers understand the language of 0 and 1 which is called a binary language. They don't understand our simple English or Hindi. Even what i am writing here is being interpreted through 0 and 1 only, which some software is doing it for the computer. In the same way database understand through their own language and that language is called as SQL ( Structured Query Language).

What Kind of Data?

A Database can store anything. You just have to define in a proper way that what exactly is needed to be stored so that the DBMS can organize it for you, to be retrieved later. We define types of data to be stored and that data type will accept only that type of data. For example , a phone number will always be an object of type number. You cannot have a phone number as : 984550ADDD.. correct ? So we need to defined the proper type for the data to be stored for better management.

How data is Stored?

For a layman's understanding, a database stores data in the form of a table , which is a combination of rows and Columns. It will organize data in such a way that an information related to each other with different objects is stored in one row and different in other. And different objects are stored in columns. Lets see the example to clearly understand this. ( Note: i'll explain about the tool being used and how to use it, in different tutorials). Lets focus on understanding the concept first.

Lets start with you only. You are a person and you have the following data related to you like : First Name, Start Name, Age , Phone No. There are many other things related to you but lets start with these only. So, the data for for different people will be stored like this as shown in the table.Basic DataAnd this is very basic for of data. The table like that contains millions of rows and hundreds of column because they need to store huge amount of data.

Working with SQL

As stated earlier, SQL is a languages which a database management system understands and to make them understand that, we write the SQL statements with which they understand our requirements and return us the relvant answers. So lets start with it rightaway. First we will learn the command to create the table. As defined earlier, we have personal data to store and so lets name the table as Personal. So to create a table with name personal we need to write the below command in sql Developer. You need to either install oracle db and run the below commands in sql developer or you can use the open source wamp server which has mysql database to use. I would prefer wamp. Its free, small , open source and easy to install.

CREATE TABLE `personal` (
  `First Name` varchar(50) NOT NULL,
  `Last Name` varchar(50) NOT NULL,
  `Age`      int(10) NOT NULL,
  `Phone no` int(10) NOT NULL

The above query will create the table personal with different types of data.

Understanding Data Type

As you saw, we create the table with two different types of data which are varchar and INT.  Varchar means variable character which means it can store string of different length. In our case we have defined the length of that string to be 50  which means the first name and the last name field cannot be more than 50. Also we have written not null in front of them which means that there should be some value for the Names and the numbers and they cannot be left as empty. Its totally on our requirement where we want to have some field as null or not. For eg. you don't want to mention last name and phone number, so you can create the table by removing not null from those fields. But currently we are having all fields as mandatory.

Lets Insert the data

Now since our table is ready, but it doesn't have any data yet, which is useless, so its time to insert the data in that. And to insert the data we have another simple query as shown in screenshot below.

Insert Data

And after running the above command, you can see the data as shown in the first screenshot earlier.

Congratulations, you have just created your first table using SQL and inserted data in that. Now try creating different types of tables and insert some data accordingly. This is just the beginning and there is lot to come. But before that i would like to know your inputs to start working on rest of the tutorials. Because it really won't make sense if it is not helping you in any way. Also you can pm me in case you are facing issues in creating or inserting data.

There are lot more intersting things to come while learning SQL. And also it is needed badly in Software Industry. So Happy Learning.

Like it on Facebook, Tweet it or share this article on other bookmarking websites.

Comments (0)

There are no comments posted here yet

Are BJP and the central government right in poking their nose in the AAP government's affairs?

No answer selected. Please try again.
Please select either existing option or enter your own, however not both.
Please select minimum 0 answer(s) and maximum 3 answer(s).
[{"id":"22935","title":"Yes, they have a right","votes":"23","type":"x","order":"1","pct":53.49,"resources":[]},{"id":"22936","title":"No, they have no business doing it","votes":"12","type":"x","order":"2","pct":27.91,"resources":[]},{"id":"22937","title":"They are not interfering at all","votes":"8","type":"x","order":"3","pct":18.6,"resources":[]}] ["#ff5b00","#4ac0f2","#b80028","#eef66c","#60bb22","#b96a9a","#62c2cc"] ["rgba(255,91,0,0.7)","rgba(74,192,242,0.7)","rgba(184,0,40,0.7)","rgba(238,246,108,0.7)","rgba(96,187,34,0.7)","rgba(185,106,154,0.7)","rgba(98,194,204,0.7)"] 350
bottom 200
No married couple wants to end up getting divorced. It is not like they have planned for it. They try to put up with their partners for as long as they
Due to our modern lifestyle, we feel that digestion related disorders are a common problem. Thus, we neither give importance to them nor seek any help
The bond of marriage brings the two people together. Initially, everything may seem okay and both of them slowly start discovering each other in the journey.
Introduction:  The oracle database server is an object-relational database management system. This write-up deals with practical aspects of compatibility
Hello and Welcome back to SQL beginners tutorial part 2. In the previous article, as a first part in the series we learnt till how to insert the data in
  The types of users and their roles and responsibilities at a site can vary. A small site can have one database administrator who administers the database
A database is a logically coherent collection of data with some inherent meaning, representing some aspect of real world and which is designed, built and
It is a collection of programs that enables user to create and maintain a database. In other words it is general-purpose software that provides the users