| |

VerySource

 Forgot password?
 Register
Search
View: 1004|Reply: 9

Help: SQL Interview Questions

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-18 23:20:01
| Show all posts |Read mode
Table g_applydetail (g_applyno, g_name, g_cardid)
g_applyno g_name g_cardid
001 Zhang San 350124
002 Lee Si 370103
003 Wang Wu 430105
004 Zhang San 350124
Find out the number of g_cardids with the same g_cardid occurrence number 2 and the number of occurrences?
Reply

Use magic Report

0

Threads

211

Posts

108.00

Credits

Newbie

Rank: 1

Credits
108.00

 China

Post time: 2020-1-25 14:54:01
| Show all posts
select g_cardid, num = count (g_cardid) from g_applydetail group by g_cardid having count (g_cardid)> 1
Reply

Use magic Report

0

Threads

211

Posts

108.00

Credits

Newbie

Rank: 1

Credits
108.00

 China

Post time: 2020-1-25 15:09:01
| Show all posts
create table g_applydetail (g_applyno char (3), g_name nvarchar (10), g_cardid varchar (10))
insert g_applydetail select '001', 'Zhang San', '350124'
union all select '002', 'Li Si', '370103'
union all select '003', 'King Wu', '430105'
union all select '004', 'Zhang San', '350124'

select g_cardid, num = count (g_cardid)
from g_applydetail
group by g_cardid
having count (g_cardid)> 1

--- result
g_cardid num
---------- -----------
350 124 2

(1 row (s) affected)
Reply

Use magic Report

0

Threads

7

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-28 13:45:01
| Show all posts
Ha ha
Reply

Use magic Report

0

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-2-1 08:36:01
| Show all posts
select g_cardid, count (g_cardid) as count
from g_applydetail
group by g_cardid
having count (g_cardid)> = 2
Reply

Use magic Report

0

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-9 14:30:01
| Show all posts
so easy
Reply

Use magic Report

1

Threads

13

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-2-16 22:45:01
| Show all posts
en
Suggest lsls
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-2-18 21:15:02
| Show all posts
Is a group\condition
select g_cardid, count (g_cardid) as count from g_applydetail group by g_cardid having count (g_cardid)> 1
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-19 14:30:02
| Show all posts
Interview questions? !! !!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-23 22:00:01
| Show all posts
First floor right
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list