TAILIEUCHUNG - Mysql your visual blueprint for creating open source databases- P6

Mysql your visual blueprint for creating open source databases- P6:The show tables command displays a list of tables available in the currently selected database. You can use this command when you are unsure of the exact name of a table within the database. | 4 ADD AND DELETE DATA The mail table was created in Chapter 2 and modified in Chapter 3. If you have not created this table and its primary key you can simply use this CREATE TABLE statement to create the table Example CREATE TABLE mail name VARCHAR 80 PRIMARY KEY address VARCHAR 120 city VARCHAR 50 state CHAR 2 postal VARCHAR 5 This command creates the mail table and specifies its five columns. The name column is defined as the primary key. Because the primary key always requires unique values the REPLACE command will replace any existing row with the same value in the name field as the row you are adding. If you use REPLACE on a table that does not include a primary key or unique index no rows are ever replaced because the table allows duplicate values for any of its columns. In this case the REPLACE command is equivalent to INSERT. -Q Type REPLACE INTO mail name address and press Enter. L0 Type VALUES Samuel Johnson 3394 Willow Ave. and press Enter. This completes the REPLACE query. Note Because the row you added with replace has the same name as the previous one it replaces the other row you added. S Type SELECT FROM mail and press Enter. The rows of the table are displayed. Because the row was replaced only one row is present. 87 MySQL INSERT ROWS FROM ANOTHER TABLE Often the data you want to add to a table is already listed in another table. You can use the SELECT keyword with INSERT to copy one or more rows from one table to another. For example the following query copies data from the address table to the mail table INSERT INTO mail name address SELECT name address FROM address In this example all of the rows of the address table are copied. The name and address fields are copied to their corresponding fields for each row. In this case the field names are the same but any fields can be used. If the field names for two tables are the same you can use a wildcard to copy all of the fields INSERT INTO mail SELECT FROM address With this syntax all of the columns

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.