This is my sample data CREATE TABLE customer1 ( rating int(9), genre varchar(100), title varchar(100) ); INSERT INTO customer1 (rating, genre, title) VALUES (2, ‘A’, ‘abc’), (4, ‘A’, ‘…
Tag: sql
Nvl function with multiple row set in oracle
I have a problem with NVL function in oracle. If I send periods variable as null it is working.There is no data in query.I mean NVL function is working properly. If I send periods variable as for …
how to validate date null in mysql?
I’m working with MariaDB. when I try to show some result don’t show me nothing. select if(fecha is null,’hello’,’bye’) dat from table I’m trying to show me some result, but I don’t know how?…
using case statement in a where clause
Hello I am missing something because my code errors. select * from ##ScheduleDetail SD left join ##HolidayFilterTbl HF on SD.Scheduledate = HF.Testdate where (ScheduleDate = testdate) and (Case …
SELECT statement with where clause on Column
I am trying to gather some data from a table with INNER JOIN with another table. What I am trying to get have 2 Types and I need to separate these 2 types in 2 different columns. In table where I am Inner joining have a column called ‘Data’ and another Column called ‘Type’ depending on…
Invaild use of group function
I am trying to make an after insert trigger that will add the bnumber to the table available with the rack-id that has the most open slots. To get this I need to take the total number of slots – the number of instances and if there are no free slots then the insert will fail. Below is what I
PIVOT with 3 tables and JOIN without number values
Hope someone can help me or point me to the right direction. I’m more of a beginner in sql language. I have 3 table users, dataTypes and usersData I only managed to use join on three tables like this: That gets all the entries for every single user like this and then repeating multiple times the same us…
How to parameterize logins when executing SQL from PowerShell command
How do we run CREATE LOGIN … against a variable string? I’m executing the following command: MasterDBSetup.sql: How do we run CREATE LOGIN … against $(SvcRRRComparisonUser) ? Answer In the $SqlVariables: Then in the SQL file:
Adding a new column to an existing table based on the contents of two preexisting columns
I am trying to add a new column to an existing table in SQL Server. I want this new column’s value to be determined based on the contents of two existing columns within the table. For example there is one column called manufacturer and another called Vendor. When the contents of these two columns are th…
update average/count from another table
I’ve been provided the below schema for this problem and I’m trying to do two things: Update the ACCOUNT table’s average_eval row with the average of the evaluation row from the POST_EVAL table per account_id. Update the ACCOUNT table with a count of the number of posts per account_id, with …