MICROSOFT SQL INTERVIEW QUESTION | Grade students as per scores mapping
Vložit
- čas přidán 10. 09. 2024
- DML Script: datasculptor.b...
Feedback: forms.gle/NQuC...
The Data Sculptor CZcams channel is a dedicated platform that explores the art and science of working with data. This channel caters to a diverse audience, including data enthusiasts, analysts, scientists, and anyone interested in harnessing the power of data for insightful and creative purposes.
The channel covers a wide range of topics related to data manipulation, analysis, visualization, and interpretation. The term "Data Sculptor" emphasizes the creative aspect of working with data, suggesting that it's not just about raw numbers but also about crafting meaningful stories and insights from the information available.
Viewers can expect a variety of content, including tutorials on popular data analysis tools and programming languages, discussions on emerging trends in the data field, case studies showcasing innovative data applications, and tips for effective data communication. The Data Sculptor aims to demystify complex concepts, making data-related skills accessible to both beginners and experienced professionals.
Whether you're a student looking to enter the field of data science, a business professional seeking to enhance your analytical skills, or simply someone curious about the world of data, the Data Sculptor CZcams channel strives to provide engaging and informative content to help you navigate the exciting realm of data exploration and analysis.
Playlists:
SQL Interview Questions: • SQL Interview questions
Recursive CTE: • Recursive CTE
Power BI and DAX: • Power BI and DAX
Data Modeling: • Data Modelling
Generative AIs: • Generative AIs
Excel: • Excel
Follow me
Linkedin: / data-sculptor-93a00b2a8
Instagram: / datasculptor2895
Thank you... Very interesting question... The logic you used in Solution is Amazing...
Also thanks for sharing more than one approach...
Glad it was helpful!
@@datasculptor2895 need some inputs on how to figure out the logic of the solution.... How to develop that...
@@gurumoorthysivakolunthu9878 You develop it with practice and experience
Hello, I have tried to solve it in (MySql).
Please have a look
with cte as (
select name,replace(subject,"%","") as subject,grade from grades where subject not like "%-%"),
cte2 as (
select * from students
where (name,subject) not in
(select name,subject
from(select s.*
from students s inner join grades g
on s.name = g.name and s.subject=g.subject) m))
select c1.*,grade from cte2 as c1
inner join cte as c2
on c1.name =c2.name
and c2.subject = replace(c1.subject,right(c1.subject,5),"")
union all
select c1.*,grade
from students as c1 join grades as c2
on c1.name =c2.name
and c2.subject =c1.subject
Hello
I just have one request please-do you think this query will cover all the test cases for this interview question?
with flo as (
select s.name, s.class, s.subject, s.marks, g.subject as gsubject, g.grade from students s
left join Grades g on s.Name=g.Name and (s.Subject=g.Subject or s.Subject like g.Subject)
),flo1 as(
select *, row_number()over(partition by name, subject order by charindex('%',gsubject))as rn
from flo
)
select name, class, subject, marks, grade
from flo1
where rn=1
order by name;
I did not insert new rows to test the solution thst s way i m asking
Thank you
Hi
Should be fine i guess. Did you try running with the existing data? I think i have covered all scenarios in the data.
@@datasculptor2895 With this data, this query I wrote gives the correct result, but only for this data. I don't know if it covers other test cases.That s way I m asking because you know sql much better then m,e.
Are these type of questions asked to freshers for an interview?
No. For freshers this should be sufficient czcams.com/video/WzEgHGLAu_0/video.htmlsi=5IBGtwObKeUDZYW2
@@datasculptor2895 Thanks 👍