SQL Introduction, Database, Creating Table and Entering Data

Information that is entered externally into the computer environment is called data. This processed data is transferred to us as information. Database is a very important issue. Whether it is internet programming, desktop programming or mobile programming, this is a language that concerns the whole IT sector.

 

Anyone can learn the database. For example, how many million people enter Facebook on a daily basis, and suppose these people share something, like something, but how many million data per second. So the guys are doing the database management so well that we don’t even feel any slowness. SQL is a database system that we can create and store the necessary diagrams and tables without losing data. It stands for the first letters of the word “Structured Query Language”.

 

What's in the article ?

SQL Introduction

If we are going to create a database system with SQL, first of all, we will carry out the studies on our computer in these lessons. To do this, you need to download Microsoft’s SQL Server program. There are many different versions of SQL Server and Developer and Express versions are free. These versions will do our job well.

 

After downloading and installing the SQL Server download, we can perform the operations of Microsoft SQL Server’s SQL Server Management Studio in cases where SQL Server is currently manageable. Now, we will talk about creating a database, creating tables and entering data for SQL Server.

 

SQL Create Database

After opening the SQL Server Management Studio program, what you need to do is call it the first process, or even connect to localhost. After connecting, you will see beyaz New Query button in the menus above and you will see a white page and we will start to enter the command on this page.

create database test

When you type the code line above and press Execute button, a new database will be created. After that, this white page can now be processed on this database:

use test

We are now ready to take action on this database.

 

SQL Create Table

The most important issue we should pay attention to while managing the database in SQL Server is that the database consists of tables. The database should be separated into tables according to the data to be entered. Now that the process we have to do is the first introductory course, we can create tables in any way and look at how the tables should be separated in the following next lessons.

create table student (name varchar(20),surname varchar(20),gender bit)

Above is the name of the table after the table command that we will create with “create table” command. In this table we will create, we open the parenthesis and enter the column name and data type to determine the columns. The data type will be learning in the next following lessons. Now we basically need to add a table and columns to the table.

 

SQL Insert Syntax

After creating database and table in SQL language and specifying the columns of the table, it is time to enter data. To enter data:

insert into student values ('Gokmen','Efsun',1)

In the above line of code, we insert data using the add  insert into command. Then we enter the name of the table where we will enter data, then  values and now we will provide data entry according to the columns of that table. If you are going to enter characters based on the letter, all you have to do is to enclose them in single quotes.

 

Yes we have now come to where we will perform the process of displaying the data we entered. For this, we can perform the data we entered from the same screen. But I’m hearing a question on your head. You will make a program or website, but not everyone will have access to SQL Server or everyone will not write their gender as 1 or 0! You’re gonna be a programmer. If the selected gender is selected as Male, you are the ones that will process your database system as one and make it appear as a Male at the time you take this data. You’re gonna make it. Anyway, here’s what we need to do to display this data:

select * from student

If the command is executed, the typed list will be displayed at the bottom of your screen.

Leave a Reply

Your email address will not be published. Required fields are marked *