Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions