A simple database return query problem

Updated on technology 2024-03-08
15 answers
  1. Anonymous users2024-02-06

    If the bonus is empty, then your salary plus bonus sal+comm is also empty.

    You can use the nvl function nvl( string1, replace with) function: if string1 is null, the nvl function returns the value of replace with, otherwise it returns the value of string1.

    select sal+nvl(comm,0) as total from emp;

  2. Anonymous users2024-02-05

    Wrong. SQL statements cannot be added directly.

  3. Anonymous users2024-02-04

    The landlord, on the first floor, can basically solve your problem, but the execution efficiency is relatively low, because the two functions are called. In fact, you can just use union directly, because union all will go out of duplicate lines, and the difference between union and union is as follows.

    The two rules are as follows.

    union, which performs a union operation on two result sets, excluding duplicate rows, and sorts the default rules at the same time;

    union all, which performs a union operation on two result sets, including duplicate rows, without sorting;

    It should be used. select number from a;

    unionselect number from b;

  4. Anonymous users2024-02-03

    select distinct number from a;

    union all

    select distinct number from b;

    Hope it helps

  5. Anonymous users2024-02-02

    Suppose the table name is dept,select, from dept d,(select sum(salary),dm from dept group by dept) b where

    In this way, we find the proportion of wages in the sector for each ID, and we get a percentage.

  6. Anonymous users2024-02-01

    It should be this logic, brother, take a look.

    declare @tab table(id int,name nvarchar(30),pic int)

    insert into @tab

    select 1,'a',1000

    unionselect 2,'b',1500unionselect 3,'a',1500unionselect 4,'b',1500unionselect 5,'b',1200select id,,pic,pics,convert(float,(pic* from @tab a

    left join

    select name,sum(pic) as pics from @tab group by name)bon

  7. Anonymous users2024-01-31

    SQL statement:

    select [id],dm,salary,total,convert(nvarchar(10), salary*100)/total)+'%'as pay ratio from table a left join

    select [dm] ,sum([salary]) total from table group by dm) b on

    table is the table name, total is the total salary of the department, and the others are the data you already have.

  8. Anonymous users2024-01-30

    Make an entity class and put the read data in the list <> according to the entity. It would be nice to just read "student name" in the loop.

  9. Anonymous users2024-01-29

    nuique means that this column cannot have duplicate fields and can have null values.

    It's pretty much the same as the primary key, but the primary key doesn't allow null values.

    distinct is a field that de-duplicates the query set.

    Your query statement above should be true, maybe you entered it under the Chinese input method.

    select count(distinct teacher) from datasheet.

    This can be done on my machine, and it can be executed with the correct result.

    You try the statement again.

    If there are still errors, please point them out.

    Supplement: There are a lot of things that can be installed on XP, such as sql2005 standard edition, sql2000, etc., but I am not very familiar with access.

  10. Anonymous users2024-01-28

    The first question uses nested queries.

    Use the unique constraint to ensure that no duplicate values are entered in non-primary key columns. Although both the unique and primary key constraints enforce uniqueness, you should use the unique constraint instead of the primary key constraint when enforcing the uniqueness below:

    A column or combination of columns that are not the primary key.

    A table can define multiple unique constraints, but only one primary key constraint.

    Columns that allow null values.

    A unique constraint can be defined on a column that allows null values, but not a primary key constraint.

  11. Anonymous users2024-01-27

    select count(distinct (teacher) )from table.

    unique is the property of the column itself, which means that the data in it is unique, and distinct is used when querying, if the column has the same data, only the first one will be returned.

  12. Anonymous users2024-01-26

    select count(teacher) from table awhere !=

    nuique should be unique.

    distinct to find distinct data.

  13. Anonymous users2024-01-25

    select count (distinct teacher)

    Are you wrong like this? I'm running fine under sql server 2k5.

  14. Anonymous users2024-01-24

    I'll give you the idea to write it yourself, first you have to start with the fifth, check four pieces of data. In other words, the first nine pieces of data should be removed.

    Then the IDs of the first nine queries are not in the top five.

    With subqueries, can you understand that?

    I don't understand hi me.

  15. Anonymous users2024-01-23

    From the fifth onwards, it should be written like this.

    select * from news where kid=3 order by niddesc limit 4,4;

    Change 5 to 4 (note that mysql starts from 0).

Related questions
8 answers2024-03-08

MySQL is unfamiliar, but the idea of database creation is the same: >>>More

20 answers2024-03-08

There is no bottom in select

select top 1 * from table order by field 1 desc" >>>More

18 answers2024-03-08

Specific software analysis.

7 answers2024-03-08

1. CNKI:

CNKI is the concept of national knowledge infrastructure, which was proposed by the World Bank in 1998. CNKI project is an informatization construction project with the goal of realizing the dissemination, sharing and value-added utilization of knowledge resources in the whole society. Initiated by Tsinghua University and Tsinghua Tongfang, it was founded in June 1999. >>>More

8 answers2024-03-08

It's nonsense to say so much above. Landlord please see: pay attention to your program: printf("%d,%d",(a,b),(b,a); >>>More