Question

Write SQL Query. Given that a table of numbers 1 to maximum of 12. In your table, there are some of the numbers missing. Gene
0 0
Add a comment Improve this question Transcribed image text
Answer #1

select le.id + 1 as start, min(fri.id) - 1 as stop

from sequence as le
left outer join sequence as r on le.id = r.id - 1
left outer join sequence as fr on le.id < fri.id
where r.id is null and fri.id is not null
group by le.id, r.id;

Add a comment
Know the answer?
Add Answer to:
Write SQL Query. Given that a table of numbers 1 to maximum of 12. In your...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Consider a table of numbers from 1-13. Give me a sql query that finds out the...

    Consider a table of numbers from 1-13. Give me a sql query that finds out the list of missing numbers by start and end. Example 1, 5, 6, 7 Answer: start end 2      4 8      13

  • 1. Given the table above, write an SQL Query that will select only those individuals that...

    1. Given the table above, write an SQL Query that will select only those individuals that scored 800 or higher, sorted by last name in ascending order. 2. Given the table above, write an SQL Query that will add a new entry for John Smith with a score of 834. The field id is auto incrementing. 3. Given the data below, write an SQL Query that will delete any values where the score is below 740. id Fname Lname Score...

  • I have no experience with SQL and I need to write commands to query the following:...

    I have no experience with SQL and I need to write commands to query the following: List all patients with the last name of “Johnson”. List all patients who are female. List all patient last names and the medical record number of each. I've watched Khanacademy videos and tried some other online tutorials but I just cannot find the information or help I need to finish this assignment. I'm in an HIM program, but that is not an option on...

  • SQL query: Write a SQL statement using the employees table and retrieve employees whose monthly salary...

    SQL query: Write a SQL statement using the employees table and retrieve employees whose monthly salary (including their commission) is greater or equal to 5,000 but less than or equal to 17,000 (we are assuming the salary on the table is monthly). In other words, if their monthly salary was 1000 and their commission was .2, their total monthly salary would be 1200 and given the criteria above this instance would not be selected. Please display the full name of...

  • Using the Cash table below, show the output for the following SQL query: (Using the dropdowns,...

    Using the Cash table below, show the output for the following SQL query: (Using the dropdowns, identify which rows and columns would included in the SQL query output shown below. Select "Not included" for rows and columns that would not be included in the output.) SELECT Account#, Balance FROM Cash WHERE Bank = ‘Boston5’ ORDER BY Amount DESC; Cash Account # Type Bank Balance 253 48.000 75,000 950 Checking Checking Draft Checking ncluded BA-6 BA-7 ot Included BA-8 BA-9 Boston...

  • Q12. (12 pts) Write SQL statements to insert the following 3 cities as well as your...

    Q12. (12 pts) Write SQL statements to insert the following 3 cities as well as your home city into the city table. If your home city is already listed, then add a different city you have visited. Leave the Population column of the last city empty. If your home country is not listed in the country table, you may also leave the Country column empty and add a comment in your SQL script file to explain this. Then write a...

  • 5. (3 pts) Write a SQL command that will insert a record into the “appts” table...

    5. (3 pts) Write a SQL command that will insert a record into the “appts” table above for a student named “Kelly”, where the advisor is “JSR”, and the room number is 5. 6. (3 pts) Write a SQL command that will display the name of students that are associated with the advisor named “JSR”. 7. (7 pts) Use the FRIENDS table to answer the following questions. LASTNAME        FIRSTNAME        AREACODE PHONE    ST ZIP --------------- ---------------- -------- -------- -- ------ BUNDY          ...

  • For each question, write a SQL query and save it as a "sql" file using a...

    For each question, write a SQL query and save it as a "sql" file using a different query 2, etc. Please execute these queries sequentially name, for example, query1.query product id (PK) category brand production_cost (Not Null) (FK) name (Not Null) Toothpaste Supermarket 1 Multivitami Supermarket 2 Shampoo acket T-shirt Supplements Supermarket Department4 Department5 Pharmacy Pharmacy 6 6 10 Query1. Update the Product table by adding another column as shown above ucts (name) with uery2. Retrieve all the uction cost...

  • Hi i need to write an SQL Query to list the given for these questions below...

    Hi i need to write an SQL Query to list the given for these questions below Example: SELECT emp_lname -- but it doent seem to work --1. Give a Listing of all the employees having their first name, last name and full name, order the report by the employee's last name --2. Give a listing of all employees that have a last name that begins with the letters between A-K --3. Give a Listing of all the employees having their...

  • : Given a specific number, consider all the numbers from 1 to given number and calculate...

    : Given a specific number, consider all the numbers from 1 to given number and calculate how many of them are odd, even and multiples of 3. For instance: number = 9 then consider {1, 2, 3, 4, 5, 6, 7, 8, 9} count of even numbers = 4   // 2, 4, 6, 8 count of odd numbers = 5   // 1, 3, 5, 7, 9 count of multiples 3 = 3       // 3, 6, 9 note. You do not...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT