SQL

Posts filed under SQL

Normalisation – A Technique to Design a Database System

Filed in SQLTags: , , ,

The Normalisation is a data analysis technique to design a database system. The Normalisation allows the database designer to understand the current data structure within an organisation. The end result of a normalisation is a set of entity. We remove the unnecessary redudency by normalising the database table. Read the rest of this entry »

SQL Server: Using Alias Name with Select Statement

Filed in SQLTags: , , ,

The Alias name is the name that is referred to any column name or table name that is given by user. The alias name also used to represent some column or table without using its real name. As we will proceed in this article we will see that how we can use both the alias column name and alias table name in SQL Server.

Read the rest of this entry »

Convert() Function in SQL Server

Filed in SQLTags: , , ,

The convert() function is used to convert an expression of one  specific data type to another type. Also this function can be used to represent the value of date/time type variable in different different format. As we will discuss later in this post we will see how we accomplish this task.

Read the rest of this entry »

How to use SQL Commands in C#.NET

Filed in ASP.NET, SQLTags: , , , , , , , , , ,

In this article we will see that how can use and execute the SQL Commands in Visual Studio. In this article we are using C# language. As we proceed in this article you will see that what steps are required to perform this task. We need the two main classes to do this. These classes are SqlConnection and SqlCommand.  First we will use to include the namespaces that are required to using these two classes. First we will include two namespaces by using ‘using’ keyword. After importing this namespaces we will create the object for SqlConnection and SqlCommand.

Read the rest of this entry »

Using if-else Statement while Inserting the Record in SQL Server Database

Filed in SQLTags: , , , ,

Today we will learn that how to use an if-else statement while inserting records into the database. We are talking about the SQL Server database. To understand this example we are understanding a problem that will make easy to  learn if-else statement. Our problem is we want to insert a record into the table named “StudentRecord”. This table have two columns named ‘student_name’ and ‘student_gender’. We will pass the name and gender as parameter in the stored procedure. Now we have to edit the name according to his/her gender. for example if the student_gender = ‘Male’ then we will add ‘Mr.’ before the name of student. Similarly if the student_gender = ‘Female’ then we will add ‘Mrs/Miss’ before the name of student. Now we are showing that how this task will be done.

Read the rest of this entry »

SQL Server Database Backup and Restore Database

Filed in ASP.NET, SQLTags: , , , , , ,

While working with database we need to store our information time to time. and for that purpose we take the backup for that database. Backing up a database provide many solutions for us. The main thing is if we lost our database from SQL Server then we can restore our database from our computer. Also when we perform changes in our database the backup database automatically update the changes to the backup file. In this article we are going to create a backup file of Database. The backup file always contain the extension (.bak). Also we are going to learn how to restore the database later in the article.

Read the rest of this entry »

Fetching Records from Multiple Tables in SQL Database

Filed in ASP.NET, SQLTags: , , , , , , , ,

When we are working with Tables in Database we need to perform some basic operation with Tables. These operations may be inserting records, updating records etc. The most important operation we need to know about the table is fetching records from the Table, also we can say retrieving records from tables. Sometime we need to retrieve records from multiple tables. When we are talking about more than a table the term “JOIN” comes in our mind. Because we use to Join two or more tables. The Joining of two or more table is very easy to implement in SQL Database. but we need to understand the basic concept of Joining. In this article we are fetching records from two tables using a simple query(not joining tables). Also we have used alias name for both tables.

Read the rest of this entry »

Constraints and Types of Constraints in SQL

Filed in ASP.NET, SQLTags: , , ,

Hello guys, I hope you are enjoy reading article. Today we are going to discuss the Constraints that we need to use in SQL while programming. Some time we need to put some type of restriction on the column of the table. These restriction are called constraints. Also we are going to discuss the types of Constraints in this article. We use constraints to bound the column so that we can perform any operation according to our requirement. Using constraints we can increase our security of database as well as we can co-relate more tables with each other…

Read the rest of this entry »

Bind Combobox with Data From Database in C#.NET WinForm

Filed in ASP.NET, Desktop AppTags: , , , , , , , , , , , , ,

A Combobox is a commonly used  Control in WinForm. It is a combination of a List Box and a single-line TextBox, allowing the user to either type a value directly into the control or choose from the list of existing options.

Sometime, We need to fetch the data from Database and bind data with Combobox Control, so that the list of data of the Combobox can be fetched from Database. Today I am going to show you how to bind a Combobox Control with SQL Server Database.

Read the rest of this entry »