Skip to content
Advertisement

Tag: database

INSERT SELECT statement with only one column for SELECT

I’m using SQL Server Management Studio 18 and I’ve got the following tables with the following columns: TableA TableB I want to do an INSERT SELECT into TableB, maybe something like the following: Basically, I just want to make an INSERT SELECT where I’m grabbing a column from another table (InternalEmplID), and then for the other columns (Month and Year),

Check datatype of column after applying function MySQL

I want to know datatype of column after using a function. After using timediff function what datatype is it? I’ve looked at the doc to search for output datatype of a function https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html but could not find, Also it would be inefficient to memorize which function outputs what datatype, so I would like to perform an operation creating new column

Double quotes problems with Postgres

I am using Django with postgres. Here’s the snippet of my code which I am using to create tables in the db. My question is: why is the user table getting renamed as “user” (with quotes) why is the role_id getting named as role_id_id where as I have clearly mentioned role_id to be my column name? Answer After reading few

Oracle “NOT IN” not returning correct result?

I’m comparing two tables that share unique values between each other using NOT IN function in Oracle but I’m getting the output is: 521254 for all charging ids –< this is the total unique charging ID’s in BILLINGDB201908 Now I want to find id’s in table BILLINGDB201908 that also exist in table CBS_CHRG_ID_AUG — the result back315567 charging ID exist

I have to get the total time spent for a question using SQL. I am unable to get the total time and provide the answer in minutes or H:M:S format

I am trying to find the total time taken per person and provide the answer in total minutes spent using SQL. The page_start_time is time data type.The data is shown below: This is the visitors table. I need to find the total time taken using the page_start_time field per USER_ID. I tried the following code: I got the following answer:

Advertisement