TAILIEUCHUNG - Java Database Programming Bible- P5

Java Database Programming Bible- P5: Welcome to Java Database Programming Bible. This book is for readers who are already familiar with Java, and who want to know more about working with databases. The JDBC Application Programming Interface has made database programming an important aspect of Java development, particularly where Web applications are concerned. | Chapter 6 Inserting Updating and Deleting Data Using INSERT . SELECT The insert statement illustrated in the example of Listing 6-1 is primarily intended for inserting records into a table one at a time. For applications such as storing information from membership applications or entering employee records this is the perfect solution. However there are times when you want to copy subsets of data from one table to another. On these occasions doing the transfer one record at a time introduces a lot of overhead because each record has to be individually retrieved from one table and inserted into another other. SQL allows you to handle these situations by combining the insert command with a select command which queries the database for the desired records. The advantage of this approach is that the whole process is carried out within the RDBMS avoiding the overhead of retrieving records and reinserting them externally. The SELECT statement The select statement is used to query the database for specific rows. This is the basic form of the select statement SELECT Fieldl Field2 . FROM TableName K WHERE . In place of a comma-delimited list of field names you can supply the asterisk wildcard character to request all fields SELECT FROM TableName Cross-Reference The select statement is discussed in detail in Chapter 7. An example of a situation where you might use is the creation of a table containing only the first and last names from the Contact_Info Table. As illustrated in Chapter 5 the SQL command to create the table is as follows CREATE TABLE Names First_Name VARCHAR 20 Last_Name LName VARCHAR 30 To insert the corresponding data from the original Contact_Info Table use a SQL command to select the desired fields from the Contact_Info Table and insert them into the new Names Table. Here s an example INSERT INTO Names SELECT First_Name Last_Name FROM Contact_Info Essentially this command tells the database management system to perform these two

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.