PHP 5/MySQL Programming- P67

PHP 5/MySQL Programming- P67:computer programming has often been seen as a difficult and arcane skill. Programming languages are difficult and complicated, out of the typical person’s reach. However, the advent of the World Wide Web has changed that to some extent. It’s reasonably easy to build and post a Web page for the entire world to see. The language of the Web is reasonably simple, and numerous applications are available to assist in the preparation of static pages | 308 PHP 5 MySQL Programming for the Absolute Beginner CREATE TABLE phoneList id INT PRIMARY KEY firstName VARCHAR 15 lastName VARCHAR 15 email VARCHAR 20 phone VARCHAR 15 You can think of fields as being much like variables but while PHP is easy-going about what type of data is in a variable SQL is very picky about the type of data in fields. In order to create an efficient database MySQL needs to know exactly how many bytes of memory to set aside for every single field in the database. It does this primarily by requiring the database designer to specify the type and size of every field in each table. Table lists a few of the primary data types supported by MySQL. Table Common Data Types in MySQL Data Type INT Description Standard integer - 2 billion roughly BIGINT Big integer - 9 x 10 A18th FLOAT Floating-point decimal number 38 digits DOUBLE Double-precision floating-point 308 digits CHAR n Text with n digits if actual value is less than n field is padded with trailing spaces VARCHAR n Text with n digits trailing spaces are automatically culled DATE Date in YYYY-MM-DD format TIME Time in HH MM SS format YEAR Year in YYYY format While the data types listed in Table are by far the most commonly used MySQL supports many others. Look in the online Help that ships with MySQL if you need a more specific data type. Other databases have a very similar list of data types. You might notice that it is unnecessary to specify the length of numeric types although you can determine a maximum size for numeric types as well as the number of digits you want stored in float and double fields . The storage requirements for numeric fields are based on the field type itself. 309 Working with String Data in MySQL Text values are usually stored in VARCHAR fields. These fields must include the number of characters allocated for the field. Both CHAR and VARCHAR fields have fixed lengths. The primary difference between them is what happens when the field contains a value .

Không thể tạo bản xem trước, hãy bấm tải xuống
171    26    2    29-03-2023
166    8    1    29-03-2023
Đã 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.