Learning SQL for beginners (0)Ajenda
This post hasn't been updated for 7 years
If you do not know about computer system development and want to learn SQL, this post may be helpful for you.
This post is an agenda, so in other post, more detail information will be written.
At first, you can visit a site bellow: http://www.wampserver.com/
After that, you can download and install to your computer. By the way, although you learn about SQL, why WAMP is required? Actually only MySQL is enough. but somehow the file size of WAMP is smaller than My SQL. So you can download and install it quickly.
After WAMP has been installed, open bellow: http://localhost/phpmyadmin
Database -> Create database -> ( name ) -> Create
Next, open "mySQL consle"
password :(null) use (name)
CREATE TABLE TMEMBER01( NID INT(3), CNAME VARCHAR(30), CADDRESS VARCHAR(40), DBIRTHDATE DATE, CNOTICE VARCHAR(20) );
drop table tmember01;
- select (show)
SELECT * FROM TMEMBER01;
-- This is same as upward SELECT NID, CNAME, CADDRESS, DBIRTHDATE, CNOTICE FROM TMEMBER01;
insert into TMEMBER01( NID, CNAME, CADDRESS, DBIRTHDATE, CNOTICE ) values( 101, 'Yokota Kaoru', 'Cau Giay', '1978/05/15', 'employee' ); --- insert into TMEMBER01( NID, CNAME, CADDRESS, DBIRTHDATE, CNOTICE ) values( 102, 'Suzuki Takashi', 'Trang Thay Tong', '1981/09/01', 'employee' ); --- insert into TMEMBER01( NID, CNAME, CADDRESS, DBIRTHDATE, CNOTICE ) values( 103, 'Yamada Norio', 'Kim Ma', '1989/12/03', 'intern' );
-- with records CREATE TABLE TMEMBER02 SELECT * FROM TMEMBER01;
-- without records, that is, only table def CREATE TABLE TMEMBER11 SELECT * FROM TMEMBER01 where 1=0;
UPDATE TMEMBER01 SET CADDRESS ='Dao Cat Ba' where NID=103;
DELETE FROM TMEMBER01 WHERE NID=102;
- all delete
TRUNCATE TABLE TMEMBER01;
This is same as "DELETE FROM TMEMBER01;". But it is faster than delete command, and better memory usage.
4. End of Practice
if you are an Oracle Database Programmer, you can find some difference between Oracle and MySQL.
How different are data types?
[note]In fact, we can use "date" in MySQL. But it is quite different with Oracle. In MySQL, "date" can have only "YYYY/MM/DD" although Oracle can have "YYYY/MM/DD hh:mm:ss". When we want to have "YYYY/MM/DD hh:mm:ss" in MySQL, we have to use "datetime" type.
All Rights Reserved