MySQL Basics Continued (3)

  1. Display all the databases
    show databases
  2. select a database
    use databaseName
  3. view the tables in a database
    show tables
  4. make a database
    create database database_name;
  5. Creat a table
    create table table_name (field_name field_type, field_name, field_type);
  6. difference between char, varchar, and text types
    char and varchar required a certain number about (e.g. varchar(20)), text does not. Text is for large text, char is for tiny and unvariable text (male, female), for a large variety in length of text use varchar. The difference is memory allocation or in other words, speed.
  7. date format
  8. When you want positive integers only
    int(10) unsigned
  9. View the table structure
    describe table_name
  10. put data in the table
    insert into tablename values (value1, value2, etc)
  11. insert only certain values
    insert into tablename (value1, value3, etc) values (data1, data2, etc_data)
  12. What is enum?
    a data type where you define specific values (eg. enum('m','f');
Card Set
MySQL Basics Continued (3)
MySQL Oreilly Chapter 3