Questions tagged as 'sql'

2
answers

Convert SQL query to MongoDB

I have little (or no) knowledge in non-relational banks. I need to convert the query below (SQLite) into an equivalent query to be run in MongoDB. SELECT COUNT(*) FROM match_table WHERE (home_team_api_id=9991 AND home_team_goal > away_team_...
asked by 12.06.2018 / 19:12
1
answer

how to subtract column date with system date?

I have a column with date data_novo and I want to know how many days the product is open, I have to make a subtraction count between the "system date" and the date it is in the data_novo column. And this result will be displayed in...
asked by 11.06.2018 / 21:20
1
answer

Export Text field to Bytea in PostgreSQL

I could make an application to export the contents of a Text field to Bytea without problems, but as they are thousands of records I believe that if I do via SQL it will be faster. If this is possible of course. I have a table with a text...
asked by 27.06.2018 / 17:36
1
answer

How to insert this text in PostgreSQL?

I'm using a Delphi query and I need to insert the text below into a text type field {\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}{\f1\froman\fcharset0 Times New Roman;}{\f2\fnil\fcharset0 Tahoma;}} {\colortbl ;\re...
asked by 27.06.2018 / 23:32
1
answer

Error creating Diagrams in SQLServer Studio 2014

This week I had a problem creating diagrams in my database (SQL Server 2014), it returned an error message:    Database diagram support objects can not be installed because this   database does not have a valid owner. To continue, first use t...
asked by 27.06.2018 / 20:54
1
answer

Problem returning a query

Why when I run the query below, it returns records: SELECT COUNT(DISTINCT(dadf332.numped)) AS qtdped, DATE_FORMAT(dadf331.datlan, '%d/%m/%Y') AS datavenda FROM dadf331, dadf332 WHERE dadf331.numped = dadf332.numped AND tipped = 0 AND da...
asked by 13.06.2018 / 15:02
1
answer

insert table into another table

Is it possible to insert one table type into another? Example: I have the BOOK table and inside it I want to create a column of type AUTOR (referring to the AUTHOR table itself).     
asked by 13.06.2018 / 19:07
1
answer

Reset sequence every year

I'm creating an identifier that has the following sequence/ano formatting, which is why I need my sequence to count from 1, again, whenever there is a year turnaround. Is there any way to do this automatically or will I have to drop and r...
asked by 05.06.2018 / 21:44
1
answer

2 calls to the same table in SQLite (output different than expected)

Given the following 2 tables: CREATE TABLE IF NOT EXISTS sugestoes ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, texto VARCHAR(250), autor VARCHAR(250), itens VARCHAR(250), pontos INTEGER ); CREATE TABLE IF NOT...
asked by 02.06.2018 / 10:07
1
answer

How to do SQL query using like comparator and multiple values out of order

I looked for answers here in the community but found nothing specific. I have a page where I can search the names of clients previously registered in a MySQL database. I am currently using the following statements: PHP: $valor = str_replac...
asked by 01.06.2018 / 07:20