Hi Experts,

I have found one solution for fourth question.
 
Question

I have products table with field's product id and product name. 
I have 1000 records in products table. But 100 product names are wrong. For 
that, I am uploading new excel file and comparing excel product id and   
products table product id.
If it matches, I am updating that product name.
For the above process, I am using for loop, Select query and Update query. For 
1000 records for loop is working fine.
What about, if products table have 10Lacs records and 1Lac product names are 
wrong.
Is for loop working?
Answer

Without using loops concept,i found one solution. By using LOAD DATA INFILE.

1.I have product table  with fields  pid and pname.

2.I am uploading excel file by using browse option.

3.Now i am creating temporary table with fields tid  and  tname.

4.I am loading LOAD DATA INFILE into temporary table.

 LOAD DATA INFILE "./a.xls" INTO TABLE temporary

5.By using below command,i am updating wrong product names.

Update product p
LEFT JOIN Temporary t
where p.pid=t.tid and p.pname!=t.tname
set p.pname=t.tname

6.Finally droping temporary table.
drop table if exists temporary;

If you need to count of wrong ones,by using mysql_affected_rows() you will find 
the count.
 
Thanks,
Gangadhara Prasad



----- Original Message ----
Subject: Queries


Hi Experts,

I have some queries, can you please clarify it.

1. I have created HTML form with textbox, text area, radio button, check box, 
dropdown box.
    How to get form name and form element names (textbox, text area, radio 
button, check box, dropdown box) in JavaScript dynamically.

2. I am using persistent connection (mysql_pconnect ()) for connecting database.
    User A is browsing my website. Now User B and C browsing my website.
    What happens here B and C are using same connection or creating new 
connection for each user?
    If B and C use same connection, is there any queue concept for allocating 
resources?

3. SELECT * FROM `emp` where ename In(select ename from emp group by ename 
having count(ename)>1).
    I have 1000 records in EMP table. For executing above query it takes 
milliseconds.
    I have 10Lacs records in EMP table. For executing above query it takes so 
much time.
    How can I reduce that time?
    How can i calculate query performance level in MySQL?

  

4. I have products table with field’s product id and product name.
 I have 1000 records in products table. But 100 product names are wrong. For 
that, I am uploading new excel file and comparing excel product id and   
products table product id.
If it matches, I am updating that product name.
For the above process, I am using for loop, Select query and Update query. For 
1000 records for loop is working fine.
What about, if products table have 10Lacs records and 1Lac product names are 
wrong.
Is for loop working?
If not what is the solution for executing 10Lacs records?


Thanks,
Gangadhara Prasad

________________________________
Unlimited freedom, unlimited storage. Get it now


      Add more friends to your messenger and enjoy! Go to 
http://in.messenger.yahoo.com/invite/

[Non-text portions of this message have been removed]

Reply via email to