Questions tagged as 'mysql'

2
answers

Values that can be entered as primary key

I have a company code for the product that consists of two letters and four numbers (example: XX0000), it is advisable to use this code as the primary key or to create another column with a code field and put unique to this code?     
asked by 22.06.2016 / 02:38
2
answers

How to duplicate a MYSQL database?

Is there any way to duplicate a database in MYSQL by running some query ? I can copy a table with this code: CREATE TABLE table_2 AS SELECT * FROM table_1 But how do you copy to replicate a given database (on the same host)?...
asked by 11.08.2015 / 22:00
3
answers

Update based on a select

I have to update the custo field of the pedidos table based on the valor field of the produtos_pedidos table. Since the a.id of the pedidos table must be equal to the b.id_pedido field of the...
asked by 28.07.2017 / 20:20
3
answers

How do I know how many days the current month has?

How to know how many days the current MySQL month has, example: setembro = 30dias Reason: I have a goal: exemplo: 1.000,000 I need to get the value of the goal and divide by the number of days it has in the current month t...
asked by 21.09.2016 / 15:46
2
answers

How to solve the error Call to undefined function mysql_connect () [duplicate]

I'm doing an IT inventory to register and I want to connect to the database, but it's giving this error:    Fatal error: Uncaught Error: Call to undefined function   mysql_connect () in C: \ xampp \ htdocs \ xampp \ cadastrando.php: 9 Stack...
asked by 22.12.2016 / 15:20
4
answers

SQL Embedded in C #

I have a C # application that uses a MySQL database with Entity Framework. However, the size of the database is ridiculously small, so I do not think it's worth having a MySQL database server just to run this application. What approach would...
asked by 02.09.2016 / 14:35
1
answer

Adding data from a column

   id .. product ... value ... sales_id ... total value       01 .. Pen .... 2.00 .... 1 .......... 30.00       02 .. Rubber. 4.00 .... 2 ........... 25.50       03..Lapis ...... 5.00 .... 1 ........... 10.00       04 .. Pointer 9.00 ... 1 ....
asked by 05.01.2016 / 19:07
3
answers

How to subtract a date from the current system date

I want to subtract the current date from the system with the date that is written to mysql. I would like to insert the date in mysql through INSERT, manually, because I will not always use the current date to insert into the system. I need to...
asked by 19.11.2015 / 03:24
2
answers

Search for two numbers at a time

Maybe this question has even been answered already, but I do not know how to do it, and I fell into the typical XY problem. I have a table that has several ids, and I need to search two id's, 34 and 5. SQLFiddle In the case above, I c...
asked by 17.09.2018 / 14:18
4
answers

Return results for all months in range

I have the following query : SELECT CAST(SUM(CASE WHEN s2.name LIKE '%Servidores' THEN (ta2.time_unit * 1.5)/60 ELSE ta2.time_unit/60 END) as DECIMAL(12,2)) AS TEMPO_CORRETO, MONTHNAME(ta2.change_time) AS MES, MONTH(ta2.chan...
asked by 18.05.2018 / 18:53