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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started