Context: I’m developing an app for windows in Visual Studio that has a table of stock materials and another of buyed materials, both in a Sql Server. I want that every time you buy something it is added into the stock table. I’m new in using SQL with c# combined. I’m trying this from a tutor…
Tag: sql
SQL: Convert bigint type to formatted date
I believe this is a simple question, but I’ve been searched around and got no satisfactory answer. Basically I have a Bigint object in MYSQL, I want to convert it to date format like 20201004, for example: I’ve tried But neither allow formatting, I hope to get the easiest and fastest conversion. A…
Is using LIMIT in SQLite gives the data or rows in “FIRST IN FIRST OUT” basis?
I am using SQLite in my Ionic project, I am saving my Log Files in SQLite server, for this I want to limit the .db file with only last 2000 data values in FIRST IN FIRST OUT basis, does using LIMIT 2000 will give me the last 2000 values stored or the first 2000 values I have stored (which is
How to show decimal value separately in PostgreSQL?
I have a table named c_price and have a column value like below in PostgreSQL. Now need a query for below result. Answer trunc() and mod() may be used dollars | cents ——: | —-: 123 | 67 db<>fiddle here
Fill every minute in an interval of timestamps with a static record in a MySQL table
I have a time series in MySQL and need to write a cycle as described by the pseudocode below: how do I write this, optimally, in MySQL? Answer You can use a recursive CTE: Here is a db<>fiddle.
MySQL – select distinct values from a column where values are separated by comma
To get the list of distinct values from table1 and column1 is as easy as doing this: However, I inherited (unfortunately) a database where column1 contains values separated by a comma I need to get the list of distinct values from column1, so it looks like this: Any ideas? Answer A generic method uses a recur…
How to connect to a Azure SQL Server through Python
I’ve come across some trouble accessing my SQL Server through Python. I can get it going when my SQL Server is installed locally, but not when it is online. I have used the following code: Connection to SQL Server but then when I try and run: I get the error: InterfaceError: (‘IM002’, ‘…
Update or add value with id
I am just learning SQLDelight and was hoping to find how to add an object with an ID if it doesn’t exist already if it does exist then update that current object with the given id. currently, I am …
I am having issues with a syntax error in PostgreSQL. I am trying to add a query and it is giving me an error
I am taking a Data Analysis Course on Udemy. I am using PostgreSQL. On one of my exercises, I tried to add a column of data and recieved a Syntax Error Message. Here is a screen shot of my code: can …
SQL pivot count and sum 2 columns
I have a table shopid times times2 shop1 5 1 shop2 2 2 shop1 6 1 shop1 1 1 shop2 1 2 Query and I got count correct for column Times Select [shop1], […