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

Mysql your visual blueprint for creating open source databases- P5: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. | MODIFY TABLES 3 L If you change the column order using ALTER TABLE it may create potential problems with applications that were built to work with the table. For example suppose an application used the following command to add a record to a table Example INSERT INTO links VALUES Netscape http Netscape Corp. This command adds a row to the table specifying values for each of the three columns. While this command will work with the current version of the links table it does not specify the columns for the insert and thus relies on the current column order. If you have changed the column order using the CHANGE or ADD COLUMN features of ALTER TABLE the INSERT command will fail or worse may insert incorrect data into the table. Applications that retrieve data without using column names can run into the same problem. While the best practice is to specify column names in all queries you can avoid these potential issues if you avoid changing the order of table columns. If your applications do use column names of course a renamed column could cause an error. Keep both of these issues in mind any time you modify a working table. See Chapter 4 for more information about the INSERT command in MySQL. Q Type CHANGE url link VARCHAR 255 and press Enter. MySQL now changes the name of the column. L-0 Type ALTER TABLE links and press Enter. S Type DESCRIBE links and press Enter. The MySQL monitor prompts for the next line. Th is displays the column list again. Note that the new name is now listed for the link column. 67 MySQL CHANGE A COLUMN TYPE While it is important to choose each column s type and attributes carefully when creating a table you can change a column s type using ALTER TABLE. The basic syntax for this is similar to renaming a table using the CHANGE keyword. For example the following command changes the description field in the links table to a VARCHAR 200 column ALTER TABLE links CHANGE description description VARCHAR 200 To avoid renaming the table .

Đã 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.