Question: using MYSQL help fix this code, here im trying to add ONLY odd lines from a file that im loading that contains 1000 records into

using MYSQL help fix this code, here im trying to add ONLY odd lines from a file that im loading that contains 1000 records into my table name called users. Since im trying to add only the odd lines i should be able to load 500 odd lines that the file "user.csv" contains.

//this line add all the 1000 records that the file contains into my table called "users" but I want to add only ODD lines from the file. how do i do that??

LOAD DATA LOCAL INFILE '/root/users.csv' INTO TABLE users FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY ' '

//this line prints out all the ODD lines. how can i put together and add all the odd lines at once while the file is being read?

SELECT * FROM user WHERE id IN(SELECT id FROM users where id%2 < > 0);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!