- Slides: 6
Select, Insert, Update and Delete using ASP. NET C# and ADO. NET
Insert, Select, Update and Delete Statements • Insert, Select, Update and Delete altogether also known as DML (Data Manipulation Language) statements which helps in managing the data with the database within schema objects. • When we have a website or an application associated with database (Sql, Oracle, Mysql and so on) then to do manipulation (i. e. Displaying, Deletion, Updating and Insertion) in the database we have to use only DML Language statements (i. e. Insert, Select, Update and Delete Statements).
Select statement • Select statement let us to retrieve the data from the database table. For ex : In simple words if we want to pick up single student record, multiple student records or all students records from the table database we just need to use "Select" statement. • Example Select * from 'students' ; "*“-means all "students" - Data Table in a database.
Insert statement • Insert statement let us to insert new record or new data into the database table. • For ex : In simple words if you want to add new student record then you need to use "Insert" Statement. Example Insert into student (student. ID, student. Name, student. Address) values (1, "Khadak Singh", "Mulund - Mumbai"); "student. ID, student. Name, student. Address" - Column Names inside student table "student” - Table in a database.
Update Statement • Update Statement let us to update existing one or more records in the database table depending on condition. • For ex: Updating existing student records. Example Update student set student. ID=2, student. Name = "Khadak Sharma", student. Address = "Parel" Where student. ID = 1; “ Where student. ID = 1 " - It is a condition, means update student record whose ID number is = 1.
Delete statement • Delete statement helps to delete one or more records from the database table depending on condition. • For ex: Removing any student from a class. Example Delete From student Where student. ID = 1; "Where student. ID = 1 " - It is a condition, means delete student record whose ID number is = 1.