Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [sql]

Structured Query Language (SQL) is a language for querying databases. Questions should include code examples, table structure, sample data, and a tag for the DBMS implementation (e.g. MySQL, PostgreSQL, Oracle, MS SQL Server, IBM DB2, etc.) being used. If your question relates solely to a specific DBMS (uses specific extensions/features), use that DBMS's tag instead. Answers to questions tagged with SQL should use ISO/IEC standard SQL.

Filter by
Sorted by
Tagged with
0
votes
0answers
7 views

How to save data from checkbox value to database using button

I'm trying to save data from checkbox to database Private Sub Check2_Click() If Check2.Value = True Then Check2.Caption = "OK" ElseIf Check2.Value = False Then Check2.Caption = "not ok" ...
0
votes
0answers
11 views

how to execute a row value in a table name

I have a condition, where my table contains a column, which has 5 rows. These 5 rows are table names and i need to execute these table names inorder to get no of rows. Also, I need to retrieve 1 ...
0
votes
0answers
8 views

How to use onchange function to get the data from database?

I have stuck in the onchange function to get the data from database, I need to choose the "Point" in the select box, then the table get what I want to select the "Point" in the select box. For ...
0
votes
1answer
13 views

How to select a value from one table where two separate pairs of conditions are met in another table

I'm sorry in advance if this is a bad question. I'm new to SQL and haven't been able to find the answer myself. I have two tables. The first table contains an id and unique words. The second table ...
0
votes
0answers
16 views

SQL Sysadmin is unable to create database

I am trying to install a MSI that is supposed to create database and install all the applications that go with it. Every time when it comes to the create database line the MSI is failing complaining ...
0
votes
1answer
17 views

SQL Stored procedure SQL Injection check

I wrote the following stored procedure for query the database, Can Someone tell me Is this dynamic query stored procedure has SQl injecttion attack risk. if it does,how to modify the following code to ...
0
votes
1answer
17 views

Can fields be removed from an ongoing cursor in PL/SQL Oracle?

I'm trying to create a massive insert from a 'temporary file', so I'm using a cursor to modify some values. I added a field based on a 'row_number()' column to get a next number created for each ...
0
votes
2answers
19 views

how to fetch all the houskeepers name & the sum of 1bed,2 bed & total_work_time at once from the selected date?

there are 2 table tbl_hk and tbl_hk_work: tbl_hk:hk_id(pk), hk_name tbl_hk_work:hk_work_id, hk_id(fk), hk_work_date, hk_work_1bed, hk_work_2bed, hk_work_time Now the problem is I want to fetch all ...
0
votes
0answers
22 views

How to make while loop of SQL result to be defined loop?

I have some trouble of my code that using while loop, here is the code : while ($row = oci_fetch_row($rskutnonindihome)){ if(angka($row[2])==""){ echo '<td class="d1"&...
0
votes
1answer
12 views

How can I match Employee IDs from 2 columns and group them into an array?

My employees have one ID for each different application. I want to find all the IDs belonging to the same employee. As input I have a table with 2 columns of IDs, ID1 and ID2 that I know belong to ...
1
vote
0answers
25 views

Developing SQL queries safely in Java

How do I develop multiple SQL conditions, and subsequently incorporate these conditions into a query along with the order by clause safely ? I'm trying to write SQL statements with potentially ...
0
votes
0answers
13 views

MySQL Error: ReverseEngineerTable: Skipping Index table.column on a LONGCHAR column

I'm migrating my Access database tables to be hosted online with MySQL. When I use MySQL Workbench to migrate it over, it throws a number of these errors during the reverse engineer source phase: ...
0
votes
3answers
26 views

Group by date and take the last one

This is my table : What I'm trying to do, is to take the last disponibility of a user, by caserne. Example, I should have this result : id id_user id_caserne id_dispo created_at 31 21 ...
1
vote
2answers
12 views

Microsoft SQL Server MAX return

I'm trying to return the first_name, last_name, and height of the tallest female(s) in a table. SELECT height, gender FROM students WHERE gender = 'F' ORDER BY height ASC I did this to find out what ...
0
votes
1answer
24 views

DUAL alternative in ms access database

I am working with windows forms in VB.NET and MS Access database. I need to check that if user already exist in my database or not and take further action accordingly. After searching for awhile I ...
0
votes
0answers
19 views

Conectar Sql Server ao php 7.3.7 no Windows

Google Translate english version I can't connect PHP 7.3.7 to SQL Server on Windows. Already downloaded the drivers, put the DLLs inside C:\MAMP\bin\php\php7.3.7 and set up php.ini calling the ...
0
votes
1answer
16 views

SQL Performance Issues with Inner Selects in Postgres for tabulated report

Using Postgres DB: I have a survey application where users enter activities and answer questions about their activities. The survey itself is called RECALLS_T, entered events are EVENTS_T, and ...
-1
votes
0answers
11 views

fetch all rows on multidimensional array database [duplicate]

i have a database like this budget | need | processorName | motherboardName | ramName low | office | AMD Touring | Compaq 354 | Touring 4x1Gb low | gaming | Intel Gaming | Kwak 447 ...
0
votes
1answer
14 views

is there way to query current row values combined with a filtered set of results from the same table with in a PostgreSQL function

I've got query which works as expected and now i would like to turn in to a function which can update values in a second table when a change occurs in a row of the source table. The query is ...
0
votes
1answer
10 views

Querying across hierarchical tables SQL

I'm having issues querying a table with a subclass. To illustrate, if I had the following tables in a MySQL database userTable: id name gender_id 1 bob 1 .... genderTable: ...
0
votes
0answers
11 views

Is there a way to have a file path in T-sql and PostgreSQL that stays within the project directory?

I am importing data from a CSV file using the COPY FROM in PostgreSQL. It works flawlessly on my machine, however, were I to clone the repository onto a new machine the code would cease to function to ...
0
votes
1answer
15 views

How to fill JavaFX ChoiceBox with seprate Enum Class?

I am trying to create a JavaFX program to manage a production line. I am working with a database so that the user can populate a database with TextField and ChoiceBox. I am having trouble filling a ...
-2
votes
1answer
20 views

Add unique id to groups of ordered transactions

I currently have a table with transactions that are sequentially ordered for each group like so: | transaction_no | value | |----------------|-------| | 1 | 8 | | 2 | ...
1
vote
3answers
23 views

Oracle IDENTITY column versus PRIMARY KEY

Having trouble finding anything definite about whether it's needed to specify that an IDENTITY column as PRIMARY KEY in Oracle 12.2c. Does an IDENTITY column automatically create an index, like a PK? ...
0
votes
1answer
24 views

Should I have parent entities for tables that share many attributes?

I am trying to design the schema for a live-action game application that supports multiple games. I have several tables that share multiple attributes such as: Assassins_Participants, ...
0
votes
0answers
15 views

SQL find specific nodes and return their values (json) as excel formatted results

There is a xml column (ArrayOfString) with json string results. I need to find specific nodes and get their value. <ArrayOfstring xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://...
-4
votes
1answer
22 views

I have a local SQL database and I want to create QR code from the data

I have a local SQL database with columns and rows with information in them. I would like to have a simple webpage with no CSS or anything. I want to be able to display the database in the browser and ...
1
vote
1answer
27 views

merge arrays in bigquery that have one common value

In big query I have a table with one column with is an array of strings. The data will look like this : ['a','b'] ['b','c'] ['c', 'd'] ['e'] Now my desired output is : ['a','b','c','d'] ['e'] ...
1
vote
1answer
20 views

How to query through all varchar columns for a specific char [duplicate]

I have to search for the char ' - ' in all columns (and lines) of my table. Currently I have this: SELECT * FROM `my_table` WHERE ( SELECT C.COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS C ...
-3
votes
0answers
13 views

How do I make updates to the new vault count document?

I need to add a grand total line and some signature line to the vault count document.
0
votes
0answers
24 views

Attach .mdf / .ldf files in SQL database from shared location in a local network

Actually, I want to install a database from installer on remote machine SQL Server from server machine.
-4
votes
0answers
16 views

User-form to retrieve data in a sql fact-table via a combo box in excel [on hold]

I'm currently trying to build a report whereby reps can utilize a User-form (preferably one with couple combo-boxes) to filter and retrieve data from a fact-table that sits in sql server 2016. I'm ...
0
votes
2answers
18 views

Get all entry where term id equal Mysql query

I have 2 tables News +---------+---------------+---------------+--------------+--------+ | news_id | title | short | body | etc... | +---------+---------------+---------------...
-1
votes
0answers
20 views

How to find correlation between non-numeric values?

I'm trying to find the correlation between non-numeric demographic variables that are currently stored as varchars. If I have two variables, ethnicity and state, how might I find their correlation? I ...
1
vote
1answer
15 views

Migration issue after scafolding. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

In trying to follow this example. After scaffolding, when I'm trying to execute the commands: Add-Migration InitialCreate Update-Database I receive this error: A network-related or instance-...
-1
votes
2answers
16 views

List all actors’ first and last names and their roles which start with the letter ‘P’

List all actors’ first and last names and their roles which start with the letter ‘P’. I've tried doing this but im not sure exactly why its not working. SELECT a.first_name, a.last_name, r.role ...
0
votes
1answer
25 views

Sum of other ID's based on date in SQL CTE

My sample CTE which is coming from multiple sources and drawing data from: with sample_cte as (ae.spvr as col1, ae.startDate as start_dt, ae.END_DT as end_dt, ROUND(ae.Scre,2,1) as Scre , from ...
0
votes
1answer
12 views

Solving Query-Errors in Vertica [Vertica][VJDBC](4160) and [Vertica][VJDBC](4680)

I have some issues in getting my Vertica query to work correctly. Let's assume I have a relation which is defined as follows: CREATE TABLE KOMM ( MANDT VARCHAR(3), DOCNUM ...
0
votes
1answer
25 views

Convert Int into time

I'm trying to convert a field into the correct format that I would like. The field is suppose to keep track of time, but it does it in military time and it is set as an Int. Can anyone help me in ...
0
votes
0answers
20 views

SQL Insert multiple rows for each record from Temp Table? [duplicate]

I'm using plpgsql just to preface. I'm looking to Insert multiple rows into Table 2 for each row in Temp Table 1 Below is an example of Table 1 and what I need Table 2 to look like. Table 1 Orders ...
-1
votes
3answers
39 views

Oracle SQL: Check if entry exists and return if it DOESN'T

I want to check if an entry exists in one table based on a value from a 2nd table, but if it DOESN'T exist then select the value from the 2nd table. To explain, I have a table called devices and a ...
0
votes
0answers
31 views

Count of one if there are more than one entry in the result?

DECLARE @StartDate AS SMALLDATETIME DECLARE @EndDate AS SMALLDATETIME DECLARE @BranchNum AS INT SET @StartDate = '2019-10-22' SET @EndDate = '2019-10-23' set @BranchNum = '4' SELECT DISTINCT s....
0
votes
1answer
23 views

Convert VARBINARY to Base64 in MySQL

This seems like a basic scenario, but I can't find relevant info anywhere. I'm new to MySQL, coming from years of Microsoft SQL Server experience. In MySQL, how do you convert a BINARY or VARBINARY ...
-1
votes
0answers
13 views

Post HTML table data in a form with input using jsp and javascript

I have a JSP file in which I have printed a table in a form which is as follows and I want to get the data from the input field which is the text field and the select field for each row and its ...
0
votes
2answers
22 views

Using standart sql, how to convert timestamp to unix time?

In mysql, one can do this in order to compare 2 timestamp : where UNIX_TIMESTAMP(transaction.closed_on)<UNIX_TIMESTAMP(transaction.opened_on)... What’s the equivalent function for Google bigquery ...
-3
votes
0answers
28 views

SQL query to find the list of users who order food from the same restaurants more than 3 times in a week? [on hold]

I have a DB which has the multiple Tables OrderDetails RestaurantDetails I am trying to figure out the how to query to find the list of users who order food from the same restaurants more than 3 ...
1
vote
2answers
27 views

Calculate time difference between 2 (non consecutive) rows

I'm newbie in SQL and I'm trying to compare two hours and see the difference between rows in columns "diff plan" and "diff done". How can I achieve this? Thank you! :) date id ...
1
vote
1answer
35 views

Combine tables with different number of columns

I need to UNION two tables that have mostly the same columns, but one has several additional columns. I'm aware that you can do a SELECT with placeholders for those additional columns, but I'm working ...
0
votes
1answer
21 views

Workaround for using BETWEEN and a WILDCARD

I have a fairly large table which contains ICD10 codes (icd10_table). I want to pull a bunch of different ICD10 codes (code) based on ranges. In short, there are parent ICD10 codes that have "children"...
0
votes
3answers
45 views

In Postgres: What is the most concise way to use `IS DISTINCT FROM` on multiple values?

I'm trying to find all rows that have an enum column that is either NULL or otherwise distinct from a given set of enum values. I can do it with a lot of IS DINSTINCT FROM calls, but it's really ...