9/8/2016 - 6:43 AM

table operations mySql

table operations mySql

show the tables inside a database show tables;

create a table create table TableName(columndetails) eg: create table EmployeeDetails (PersonID int, LastName varchar(255), FirstName varchar(255), City varchar(255));

insert data to a table INSERT INTO EmployeeDetails (PersonID, LastName, FirstName, City) VALUES ('4005','Kallis','Jaques','Cape Town');

show all the contents of a table SELECT * FROM [table name]; eg: SELECT * FROM EmployeeDetails;

show a specific colum of a table select column_name from tableName; eg: select wi_creation_date from action_item_wizactionitem;

how to check the schema of a table describe tablename; eg: describe action_item_wizactionitem; (but for this you need to get in to the database where "action_item_wizactionitem" table is located)

update a field in a column of a table UPDATE testtable -> SET FirstName='James' -> WHERE PersonID=4005;