Questions tagged as 'sql'

1
answer

Sql - Modeling Database

I would appreciate help. I do not know how to create tables in the SQL database My problem is this: I have a user with a request with multiple items. I already have the users and products table How do I create this table that contain...
asked by 11.04.2017 / 01:02
2
answers

Return values smaller than 10 of a column with DateDiff

I need to return values less than 10 in a column with DATEDIFF and others between 10 and 20 in the same column. Can anyone help me? SELECT CONVERT(VARCHAR(10), (MAX(REMESSA.DT_USO_FIM)),105) AS DATA_DEVOLUÇÃO ,DATEDIFF ( DAY, MA...
asked by 10.04.2017 / 20:48
1
answer

SQL query to return only if upper case

I would like to make a query in a column and that the return would be only the capitalized words that match the searched criteria (user input), regardless of whether the criteria was typed in uppercase or lowercase. CREATE PROCEDURE uspConsult...
asked by 26.03.2017 / 22:23
1
answer

How many percent N item represents in the grand total - Query

Good morning, I'm creating a report on the ABC curve, but I'm a beginner and I still have some difficulties. I have a table called: ITEMS. With fields: COD_ITEM, Sales Quantity, Unit Value, Subtotal, Description With an SQL query I was abl...
asked by 12.05.2017 / 15:32
2
answers

Count function - Mysql

I have the following tables: times - time_id INT - time_nome VARCHAR rodadas - rod_id INT - rod_rodada INT - rod_pontos DECIMAL (10,2) - rod_fk_time INT I need to add punctuation and group by time.     
asked by 18.05.2017 / 19:09
2
answers

PHP- code conflict - blank page

The following code allows the user to log in and direct to a particular page, or log in as an administrator and direct to another page. The user login is working, however when logging out appears undefinied variable on line 28 and 29. And if I t...
asked by 25.05.2017 / 14:24
1
answer

Cost of processing between code and database

Among the many forms of development, there was a doubt about what will consume more of my processing between the same operation in different ways ... If I have a function that can be done directly in my database (a insert using a se...
asked by 27.04.2017 / 20:55
1
answer

Remove first character from Index

Good afternoon. I have a varchar with some numbers set @ID_CUSTOMERNUMBER = '01234567' I would like to remove the zero only if it is the first number of my variable, eg '0123456789' removing the zero would be '123456789' '123401234...
asked by 27.04.2017 / 18:32
2
answers

Use foreign key as primary key - Hibernate

I'm implementing hibernate in my project and I've reached a stage when I'm having trouble mapping my entities. I have an entity called Book and would like to create an Inventory entity to store the number of books I have, however, I would lik...
asked by 05.03.2017 / 20:40
2
answers

SELECT per word in sql server without using Full Text Index

I need to query a table with the following words:    "Today was a rainy day" I need to search for any of these words. For example if you found the word "day" , you would have to return the record. That is, any of those words that I think...
asked by 03.03.2017 / 17:55