Skip to content
Advertisement

Tag: sql

How can eliminate the line that counts everything [COUNT function in SQL]

I was running a code where I needed to see the top 10 results in a table. Unfortunately, I am with one more row that I was expecting. My results was the following: [Result after the query][1] [1]: https://i.stack.imgur.com/KCu7W.png Is there any way I can eliminate row 1 from my query? Thank you in advance for any assistance! Answer try

Simple Query – what’s wrong with it?

I’m trying to answer exercise 2 with the above (try it yourself here: https://sqlbolt.com/lesson/select_queries_with_nulls), but it’s not returning anything. Is it a problem with the site or my query? Thanks! Answer I checked your query, according to the question that was on the site, you can easily extract the desired data using a sub-query. in this query first of all

Left outer join not showing unmatched pairs Oracle SQL

I have a table like this, let’s call it main location item price l1 item1 3.00 l1 item2 1.00 l2 item1 3.00 l2 item2 1.50 l2 item3 2.00 l3 item4 5.00 l3 item5 5.00 and a separate table, call it items items item 1 item 2 item 3 item 5 item 4 item 5 item 6 and am currently trying

EF Core transaction lifetime

We are using our select statement inside transaction scope because of concurrency concerns. The question is, if I put my transaction in using statement, do I still have to call Commit() method explicitly to be sure that the transaction is closed or Dispose() method will do the job? Here’s example code: Answer The official docs would be your best friend

SQL query to get / delimited column value in single row

I have this output: Table 1 Requisition_number per_id per_name Job_title Interview TAS_EMAIL_ADDRESS TAS_FNAME 22021 1097 Chad Manager This is a comment abc.g@gmail.COM abc 22021 1097 Chad Manager This is a comment xyz.g@gmail.COM xyz I want the output to look like this: Requisition_number per_id per_name Job_title Interview TAS_EMAIL_ADDRESS TAS_FNAME 22021 1097 Chad Manager This is a comment abc.g@gmail.COM abc/xyz 22021 1097

Create a “flag” table that references unique IDs in 3 different tables

Oracle SQL I have account IDs in 3 different tables (one column per table). They sometimes repeat within the table’s column. Some of the distinct account IDs in Table 1 also appear in Table 2. Some appear in all 3 tables. There is no mutual exclusivity requirement across the tables (i.e – an account ID can appear in any combination

Consolidate Rows with SQL

Trying to consolidate test results so that each test is in one row. Database I am pulling from has an answer result per row. Sample Data: Student Name Test Name Question Attempt Answered Correctly (0 = no, 1= yes) Mary Intro Assessment 1 1 Mary Intro Assessment 1 0 Mary Intro Assessment 1 1 Joseph Intro Assessment 1 1 Joseph

SQL Inner join with sum and null value

The table below is an extract of a larger set of data In my scenario Column 2 is null when is the “parent” record (Column 1 = AB1 and Column 2 is NULL) and as you can see the following 2 “child” records under Column 2 have AB1 as identifier which matches the AB1 from Column 1, what I want

SQL Group Multiple Results from Single Table

I have a table that contains a line entry for each item that I need to group into an output with all the values of multiple rows that have the same uniqueID into one column result. The ItemType will be different but the UniqueID and OtherData shouldn’t change as it’s tied directly to the UniqueID, but I’m not 100% sure

Advertisement