Skip to content

Instantly share code, notes, and snippets.

@2arunpmohan
Created September 8, 2016 06:43
Show Gist options
  • Save 2arunpmohan/337624d23d648f7acb5b810516e83a4d to your computer and use it in GitHub Desktop.
Save 2arunpmohan/337624d23d648f7acb5b810516e83a4d to your computer and use it in GitHub Desktop.
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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment