MySQL Left Outer Join
Nov 16, 2009 Mysql
Joins are very interesting topic in mysql.In my 4 years exp. i feel that every body knows about joins (experts and freshers) but freshers use joins very few.This may be because of their low thinking capability in starting or may be they find joins more typical then their local logic.Maximum beginners try to put their own logic rather then joins.
Today we will talk about left outer join .Not very common join but very effective join.
Suppose you have 2 tables. First “table1″ with 2 fields ‘id’ and ‘name.’ . Second “table2″ with 2 fields ‘id’ and ’salary’.In table1 “id” is primary key and in table2 field “id” is foreign key.
Tags: fetch, inner join, join, joins, left join, left outer join, Mysql, mysql join, mysql joins, records, right join, right outer join, self join
How to insert data from one table to another table in mysql
Oct 5, 2009 Mysql
To Insert field values from one table to another in mysql use this simple query
INSERT INTO tablename1 (field1,field2,….,fieldn) SELECT field1,field2,….,fieldn FROM tablename2 WHERE condition
concat function in mysql
Oct 5, 2009 Mysql
CONCAT function in mysql is used to concat two strings.
For ex. CONCAT(’firstname’,’ lastname’);
This functoin will concate this two word and create a single word.
Uses:
SELECT concat(’firstname’,' ‘, ‘lastname’) AS name FROM tablename .
you can concat many words as you want.In the example above we also concated a space between firstname and lastname to seprate them
Different text fields in Mysql and their field size
Oct 5, 2009 Mysql
In mysql there are three type of text fields with different length
1. Text = 65000 Bytes.
2. Medium text = 16 million bytes.
3. Long text = 4 trilian bytes.
Tags: bytes, Mysql, text field
What is the difference between mysql_connect() and mysql_pconnect() ?
Sep 18, 2009 Mysql
mysql_pconnect() makes a persistent connection to the database which means a SQL link that do not close when the execution of your script ends.But when you make a connection with mysql_connect then sql link will be automatically close after the execution of your script.