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...

  • 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...

  • NEED the SQL query that solves each problem 4) List the member numbers of all members...

    NEED the SQL query that solves each problem 4) List the member numbers of all members who rented a movie. Do not list duplicates. (w3schools -> SQL Distinct) 5) List the member names [first and last] for members from Kentucky {KY}. (w3schools -> SQL Where) 6) List the names of all movies in alphabetical order (w3schools -> SQL ORDER BY) 7) List the movie title and cost in descending order by cost (w3schools -> SQL Order By) 8) List all...

  • a.From the table below, Use sql query to give the total cost of each Ice cream...

    a.From the table below, Use sql query to give the total cost of each Ice cream flavor b. give the count of customers that like exactly two flavors CUSTOMER (Cust_ID, Cust_name, year_born) They want to link CUSTOMER to their database. Customer flavor preference is shown in table 2. Following tables are from assignment 1 ICECREAM (Ice_cream_ID, Ice_cream_flavor, price, years_first_offered, sellling _status) INGREDIENT( Ingredient_ID, Ingredient_name, cost) RECIPE (Ice_cream_ID, ingredient_ID, quantity_used) WHERE: Ice_cream_ID is the internal Id given to an ice cream....

  • SQL: Write a query to, by store (number), list the maximum number of store visits made...

    SQL: Write a query to, by store (number), list the maximum number of store visits made by a customer. Date_Dimension Date_Key Date Description Day OF Week Day Description Weekday Flag Day OF Month Day OF_Year Month _Descrip... Month Of Year Quarter Descr... v Time_Dimensi... Item_Dimension (dbo. Time_Key ?Item_Key Time Description AM PM Item Number Category_Number Sub_Category_Number Primary_Description Secondary_Description Color Description Size_Description Item Status Code Fineline Item_Scan_ Fact (dbo.Item... Visit Number Store_Key Item Key Member_Key Transaction_Type Key Transaction_Date Key Transaction Store...

  • For this hands-on project, you will use the SQL Server named instance SQLSERVERHOA, and the HandsOnOne...

    For this hands-on project, you will use the SQL Server named instance SQLSERVERHOA, and the HandsOnOne database and tables you created in previous chapters. The objective of this activity is to practice generating keys and encrypting/decrypting data. Document each step by taking a screen shot of the Query Editor window after successfully executing each SQL query. 1.In SQL Server Management Studio, open a new Query Editor window, which you will use for completing all steps in this activity. 2.Create a...

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
ADVERTISEMENT