MySQL Functions (4&5&6)

  1. get the current date
    select now();
  2. convert a date to days function
  3. Get the month from a date function
    select month('1999-10-09');
  4. Get a day from a date function
    select dayofmonth('1999-10-09');
  5. get the year function
    select year('1999-10-09');
  6. Redefine a label or title in a query
    With the "as" keyword select month('1999-10-09') as month,
  7. place something into the database requires what format?
    insert into tableName values (value1,value2);
  8. Delete a line
    delete from tablename where arguement.
  9. rename a table...there are two sections of keywords.
    alter table tablename rename as tablenamenew;
  10. change a data type of an existing column
    alter table tablename modify column datatype.
  11. If you want to insert a new column in the front of all the existing columns in a table
    use first as in " alter table officeproducts add columnname text first
  12. how fo you add another column after an existing one?
    use the "after" keyword as in "alter table tableName add newcolumname after currentcolumnanme"
  13. delete a column
    drop columnName as in "alter table tablename drop columnName;"
  14. add a column
    use the add keyword as in "alter tablename add columntobeadded columndatatype"
  15. delete a table
    drop table tablename
  16. create a table
    create table tablename (column1 column1datatype, etc)
Card Set
MySQL Functions (4&5&6)
Oreilly lesson 4&5