23.03.2017 Views

wilamowski-b-m-irwin-j-d-industrial-communication-systems-2011

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Development of Interactive Web Pages 62-9<br />

To view tables, type the following command.<br />

mysql> SHOW TABLES;<br />

62.4.3 Modifying Tables<br />

To delete a table, type<br />

mysql> DROP TABLE ;<br />

To insert data into a table, type<br />

mysql> INSERT INTO <br />

(column1, column2, …)<br />

VALUES (value1, value2, …);<br />

Example:<br />

mysql> INSERT INTO employeeinfo<br />

(LastName, FirstName, Department, Employee_ID)<br />

VALUES (Rives, John, Sales, 2);<br />

To update data stored in a database table, type<br />

mysql> UPDATE SET<br />

=, …<br />

WHERE ;<br />

Example:<br />

mysql> UPDATE employeeinfo SET FirstName='Johnny' WHERE<br />

LastName='Rives' AND Employee_ID=2;<br />

To delete a record from the table<br />

mysql> DELETE FROM table_name WHERE some_column=some_value;<br />

Example:<br />

mysql> DELETE FROM employeeinfo WHERE LastName='Tent';<br />

To delete all rows<br />

DELETE * FROM employeeinfo;<br />

62.4.3.1 to View Data<br />

The SELECT command is used for viewing data stored in your database tables.<br />

Syntax:<br />

SELECT column_name(s) FROM table_name;<br />

Example 1: To display data from columns LastName and Department.<br />

mysql> SELECT LastName, Department from employeeinfo;<br />

© <strong>2011</strong> by Taylor and Francis Group, LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!