0% found this document useful (0 votes)
2 views

database1

The document provides an overview of relational databases, explaining their structure, including tables, rows, columns, primary keys, and foreign keys. It also discusses SQL commands for data manipulation and introduces ADO.NET 4 as a data access API for .NET applications, detailing its key classes like SqlConnection, SqlCommand, and SqlDataAdapter. Additionally, it highlights concepts such as result sets, joins, and data types in database management.

Uploaded by

achu48547
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

database1

The document provides an overview of relational databases, explaining their structure, including tables, rows, columns, primary keys, and foreign keys. It also discusses SQL commands for data manipulation and introduces ADO.NET 4 as a data access API for .NET applications, detailing its key classes like SqlConnection, SqlCommand, and SqlDataAdapter. Additionally, it highlights concepts such as result sets, joins, and data types in database management.

Uploaded by

achu48547
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Relational Database

• A database is an organized collection of structured information, or data, typically stored


electronically in a computer system. A database is usually controlled by a database
management system (DBMS).

• In relational database, data is stored in one or more tables.

• Each table consisting of rows (records)and columns(fields).

• Each row contains information about a single item.

• If a table contains one or more columns that uniquely identifies each row in the table, it is
defined as primary key of the table.

• Primary key consists of two or more columns. It is called a composite primary key.

• The only difference between unique key and primary key is that unique key contain null value
and a primary key can’t.

• A table can also be defined with one or more indexes.

• An index provides and efficient way to access data from a table based on the values in
specific columns.

• An index is automatically created for a table’s primary and non-primary keys.

• Foreign key is one or more columns in a table that refer to a primary key in another table

• The data type that is assigned to a column determines the type of information that can be
stored in the column.

• Depending on the data type, the column definition can also include its length, precision and
scale.

• Each column definition also indicates whether or not the column can contain null values.

• A null value indicates that the value of the column is not known.

• A column can be defined with a default value. Then, that value is used for the column if
another value isn’t provided when a row is added to the table.

• A column can also be defined as an identity column.

• An identity column is a numeric column whose value is generated automatically when a row
is added to the table.

• To restrict the values that a column can hold, use check constraints. It can be defined at the
column level or the table level.
SQL to work with data in database
• SQL statements which are used to manipulate the data in a database is Select, Insert, Update
and Delete.

• A result set is a logical table that is created temporarily within the database.

• When an application requests data from a database, it receives a result set.

• A result set can include columns that are calculated from other columns in the table.

• To select all of the columns in a table use asterisk (*) in place of the column names.

• A join combine data from two or more tables in to a single result set.

• The most common type of join is an inner join. Inner join returns rows from both table only if
their related columns match.

• Insert, Update and Delete statements are used to add new rows to a table, to update the
data in existing rows and to delete existing rows.


Introduction to ADO.NET4
• ADO.NET 4(Active X Data Objects) is the primary data access API for the .net framework.

• It provides the classes which are used in developing database applications.

• ADO.NET uses two types of objects to access the data in a database.

1.Datasets

2..NET data provider includes data adapters, commands and connections

• Data used by an application is stored in a dataset that contain one or more data tables.

• .NET data provider objects retrieve data from and update data in the database.

• To load data in to a data table data adapter is using.

• The main function of the data adapter is to manage the flow of data between a data set and
a database.
Concurrency and the disconnected data architecture
Introduction to ADO.NET4 Classes
1. SqlConnection class

• A SqlConnection object is required to establish a connection to a SQL Server database.

• Most important property is ConnectionString. A connection string is a string that provides


the information that is needed to connect to a database.
2.SqlCommand class

• A SqlCommand object is used to execute a SQL command against a SQL Server database

3.SqlParameter class

• A SqlParameter object is used to pass variable information to a SQL command. Used to limit
the no of rows returned by a select statement.
4 SqlDataReader class

• The SqlDataReader object is used to read a row of record at a time which is got using
SqlCommand.

• It is read only, which means we can only read the record; it can’t be edited.

• And also it is forward only, which means we can’t go back to a previous row (record)

5 SqlDataAdapter class

• The SqlDataAdapter works as a bridge between a DataSet and a data source (SQL Server
Database) to retrieve data.

• The SqlDataAdapter is a class that represents a set of SQL commands and a database
connection.

• It can be used to fill the DataSet and update the data source.

You might also like