Ask 1 SQL Reading and Writing Problem 20

Updated on educate 2024-05-26
10 answers
  1. Anonymous users2024-02-11

    Simple. It's not challenging.

  2. Anonymous users2024-02-10

    Ah, you have this book too, it's a good book, and the first textbook I used to teach SQL was this book.

  3. Anonymous users2024-02-09

    I agree with the statement upstairs, first treat the next SQL statement as a table, and perform a joint query with the previous table!

  4. Anonymous users2024-02-08

    --This should work, and the order of the results is not too different from yoursselect , count(*).

    from test t1

    join test t2 on = and order by ,

  5. Anonymous users2024-02-07

    This is a bit difficult, my idea is that 2 functions, 1 stored procedure, 1 function, can find how many levels there are in this table.

    1 function can return which is the root of a piece of data, which is the secondary root... Which is the nth layer root.

    The stored procedure then organizes the statement according to the return value of the first function, sort by root, sort by secondary root. Nth layer root sorting.

  6. Anonymous users2024-02-06

    select count(a.) as **Number from (select ****,**Price from table where date=3) a

    join (select ****,**valence from table where date=2) b

    on a.****=b.****。

    where (a.Price-bPrice-bPrice between and

    and left(a.****,1,5)='sh601'

    aahuichao: how can you run without linking the two tables.

  7. Anonymous users2024-02-05

    select count(a.****)

    from (select ****,**price from the original table where **** like.)'sh601%'and date=3) a,(select ****,**price from the original table where **** like'sh601%'and date=2) b

    where a.****=b.**** and (a.Price-b**Price) aPrice between and

    Thank you downstairs for the correction.

  8. Anonymous users2024-02-04

    The third floor is the right way, but the corresponding condition should not be the ID, but the Name.

    dense_rank() over(partition by id order by id,time desc) ×

    dense_rank() over(partition by name order by time desc) ○

    If you want to extract the top 20, you can add a SQL statement in front of the top 20.

    select top(20) id, name, time from (select id,name, time ,dense_rank() over(partition by name order by time desc) rank from table_name

    x where rank <=3 order by time desc

  9. Anonymous users2024-02-03

    Let's use the window function:

    Don't know what database you're using:

    The following SQL is available in both Db2 Oracle and SQL Server:

    select * from (

    select id,name, time ,dense_rank() over(partition by id order by id,time desc) dr

    from table_name

    xwhere dr <=3

    Understand the dense rank function.

    Added: select top 20 * from (select id,name, time ,dense rank() over(partition by id order by id,time desc) dr

    from table_name

    xwhere dr <=3

  10. Anonymous users2024-02-02

    Upstairs is wrong, and what comes out is the first 3 records.

    select top 3 *

    from Staff Table.

    group by name

    order by time desc

Related questions
10 answers2024-05-26

There is no date type, only datetime, which you can use varchar(10) instead. >>>More

26 answers2024-05-26

One of the reasons for acne is**too dehydrated, you choose a acne cleanser, the cleaning strength is stronger, like you**, not acne**, is a typical oily**, so you must hydrate when going to oil, otherwise it will become dehydrated oil**, you will have acne, because you are in puberty, male hormone secretion is more, sebaceous gland secretion is vigorous, large pores and oily are determined by your **nature, in daily care you had better use oil-soluble cleaning products, Then use water-soluble cleaning products, and regularly do deep cleaning for **, choose a more refreshing lotion or gel to use. >>>More

10 answers2024-05-26

1.The annual package is about 300, the quarterly package is more than 100, and the monthly package is about 60. >>>More

10 answers2024-05-26

If the whole building is yours, you have to sit in the direction of the building, you only live in one unit, you have to sit in the door of your house (that is, there are large floor-to-ceiling windows and balconies on three sides), in feng shui, such a house is called a house (sitting west to east), this kind of house is in the southwest corner, this is just a simple residential position, and it should be calculated in combination with the fortune hexagram of the owner.