Can I use other conditions?

Yes, you can use various conditions in your SQL queries to filter results. Here are some common options:

  1. AND: Combine multiple conditions.

    SELECT * FROM <table_name> WHERE id = x AND status = 'active';
  2. OR: Retrieve rows that meet at least one of the conditions.

    SELECT * FROM <table_name> WHERE id = x OR name = 'John';
  3. LIKE: Search for a specified pattern in a column (useful for string matching).

    SELECT * FROM <table_name> WHERE name LIKE 'J%';  -- Names starting with 'J'
  4. IN: Check if a value matches any value in a list.

    SELECT * FROM <table_name> WHERE id IN (1, 2, 3);
  5. BETWEEN: Filter results within a range.

    SELECT * FROM <table_name> WHERE created_at BETWEEN '2023-01-01' AND '2023-12-31';

You can combine these conditions to create more complex queries. If you need further examples or explanations, let me know!

0 Comments

no data
Be the first to share your comment!