| Home | JSP | EJB | JDBC | Java Servlets | WAP | Free JSP Hosting | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML | ||||
|
||||
| Tutorial Categories: Ajax
| Articles
| JSP
| Bioinformatics
| Database
| Free
Books |
Hibernate
| J2EE
| J2ME
| Java
| JavaScript
| JDBC
| JMS
| Linux
| MS
Technology |
PHP
| RMI
| Web-Services
| Servlets
| Struts
| UML
|
MySQL Creating and Deleting DatabaseIn this section you will learn how to create and delete the database in MySQL. MySQL provides the both commands. In this section you can learn the following things :
Once you enter the command prompts then ready to access the database. Before creating a database firstly check the currently existing database in the server by SHOW statement.
SHOW statement shows you a list of databases. This statement does not show you those database for which you don't have the privilege for. Creating And Selecting a Database
This statement is used for creating a database by the
name of search. But if the administrator is creating a database for you then you
have to setting up the permission before using it. Else create it yourself.
You have to create the database only once but if you want to access this database then you have to select it to each time by using USE statement. MySQL Creating Table
The most important part is deciding the structure of the database means what tables you are required and what type of column you should have in each table. By the following example you can learn about the creation of table :
If you want to show the structure list of your table then use DESCRIBE statement. like :
After creating the table you need to load the data in this table, you can do this by using the INSERT statement. Following example is helps you to teach the INSERT statement.
After inserting the data into the table, now we discuss about retrieving the data from the table. For retrieving the data we used the SELECT statement. The general syntax of SELECT statement is :
colum_names means what you want retrieve. It can be column names or * that means all columns data. table_name means table name from that you want to show the data But WHERE clause is optional. It is used where you want to put some condition for retrieving the data.
In above table first statement is used to retrieve the full list of table Emp. But from the second statement you get the only fname and lname column of whole table. And by the third statement you will get the only row that match with the fname equals to 'Amar'. If you need to delete the database then you have to use the DROP statement. Example -
CREATE USER Syntax : CREATE USER user_name [IDENTIFIED BY[password]
'password']
MySQL drop User syntax:
|
| Facing Programming Problem? | |||||||
| Add This Tutorial To: | |||||||
| |
|
|
|
|
|
|
|
![]() |
|
JDO Tutorials EAI Articles Struts Tutorials Java Tutorials Java Certification |
|
|
|
||||||||||||||||||||||||||||||
|
Home | JSP | EJB | JDBC | Java Servlets | WAP | Free JSP Hosting | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs |
||||||||||||||||||||||||||||||
Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.
Copyright © 2007. All rights reserved.
Current Comments
2 comments so far (post your own) View All Comments Latest 10 Comments:I satisfied by this description as student of Mysql N i want thorough intellengy of practical knowledge of company. So, please give the brief descriptions adding syntax..........
Posted by sheikh abdul rahiman on Friday, 10.19.07 @ 11:19am | #34380
mysql>INSERT INTO Emp VALUES('Amar', 'Patel', 'Delhi', 'M', '14-02-2004'); on running this mysql returns an error
the correct query is
insert into emp values('amar','patel','delhi','m','2003-03-31 11:22:12');
we should also give tim ewhile hard coding the date to be inserted
Posted by bluesbug on Monday, 07.23.07 @ 14:51pm | #21767