1
db.music.find({deleted: {$ne: true}});

the above code is in mongo db

I want to know how to write the equivalent for this in sql

thank you

2 Answers 2

1
select * from music where deleted != true;

or, optimized:

select * from music where deleted == false;

Depending on the version of SQL, the false could be 'false', 0 or '0'

Assuming:

  • You're already on the right database (no need to put use my.db at the beginning of your script)
  • Your deleted column is of type boolean or bit.
Sign up to request clarification or add additional context in comments.

Comments

1

Assuming your storing [deleted] as a bit or nullable bit then :

Select * from [music] where [deleted] != 1

But you can't use sql to query MongoDB, you know that right?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.