sql's questions - Chinese 1answer

10.130 sql questions.

There is two main tables in database (SQL Server 2014) table1: ---------------------------------------------- id name datetime image table2: -------------------------------- ...

I have recently migrated Mysql 5.1 to Mysql 5.7. DB Migration was successful but when the application started firing few selected queries, Mysql started taking hours to execute them for which ...

I have 2 tables that handle asset management and I'm trying to create a report that lists each asset under its location (which is determined by the desk_id, referencing the location in table 2) Table ...

I've already search the net about this but it can't solve my problem. I have two tables one with 10 rows and other with 9 rows table 1 RNUM JOB_ID ---------- ---------- 1 ...

I need to write a stored procedure that will accept two input string parameters and will encrypt the data as explained below. First parameter should be the message to encrypt and second parameter ...

I am working on a report, one of the requirements is that I find the turnaround time between two dates (columns) - I have done that using a DATEPART function, however, the hours are exaggerated, I ...

Need to convert the following oracle queries to MySQL queries. 1) select to_char(to_date(?,'DD-MM-YY')) from dual; 2) select to_char(next_day(to_date(?,'DD-MM-YY'),'FRIDAY')) from dual; 3) ...

I have a SQL Server 2016 SP1 production server. It's been running without a restart for 330 days. Everything's been running fine. Until last week, one day, all of the sudden, every query on the server ...

When we execute SHOW global status; or SHOW variables; we get list of 291 and 278 records in the resultset. For performance perspective, only few of them are much important. I have to fetch these ...

How are subqueries in the column field of select (projection) paired with the result of the main query? in the form: SELECT id,email,(SELECT name From Names WHERE Names.id=Users.id) as name FROM ...

I am getting an error while running an update query with table name specified along with column name: UPDATE Temp SET Temp.Id='234',Temp.Name='Test'WHERE Id='245' This is the error: ERROR: column "...

DB-Fiddle The resulting table should have the same number of rows as the first table while adding the column State from Table 2. This State value should be the highest SRC_DT value that is lower than ...

I'm trying to read the content of /etc/passwd from mysql using the following query: select load_file("/etc/passwd"); However, I always seem to get NULL as the output. mysql> select load_file("/etc/...

I have table A which size is 32GB and has the following 5 fields: a (int) b (varchar(128) c (varchar(128) d (int) e (int) a, b and c are unique key. Now, when I query like this: select * from ...

I'm referencing to a very good blog entry, that describes how to sessionize log data with SQL window functions. I'm no database pro and I don't really understand the logic behind this query (you can ...

I am working in sql server 2016 with Filestream attribute column. I have a column with filestream attribute activated on it. when I insert a reacord in TSQL , the associated file is created in ...

I need to UPDATE all rows for multiple columns on a large INNODB table. Each UPDATE processes one column separately and takes about 1 hour. I have to do this for 10 columns so it would take 10 h I do ...

In a MySQL database, I have a table full of business information. Lots of businesses have been inserted twice due to human error, so the same information exists with two different primary keys. Let'...

I am using a Control File to import data from a CSV file into a table, using sqlldr to import the data, where a large number of fields are numeric values with integer and decimal part separated by ...

I'd really appreciate some help with an SQL query across tables. its need to know all the orders of the clients before the orders of table_1 Table_1 Companny | Warehouse | Order | Client | Date ...

I have some fields in my database which contain values like 2483-5802 and 1245-3325. Now I have a user input and I have to find it from this column. Example if I have to search 2000 which will come ...

I need to implement a data type which should preserve the last zeros in the decimal points in SQL Server 2008 R2. Example of the data are 1.002 1.210 0.00100 0.1401 My clients get lab measurements ...

I have two tables with the following schema id, fruit In TableA the values are like this: A01, Apple A02, Orange A03, Pineapple A03, Pineapple A05, Banana In TableB the values are like this: A01, ...

I have a table named _Test which has the following values stored in it. Primary Key : Id I also have designed a trigger on that table ALTER Trigger [dbo].[_Test_Data_Save] On [dbo].[_Test] For ...

I have been trying to run a MySQL database in a Docker container using the official image. I can run everything OK but I have a problem with inserting accents. The thing is that I can not insert ...

I need to run sp_depends on multiple stored procedures on Sybase to get dependencies. Since I have a lot of stored procedures, I wanted to know if there is any way to force sp_depends output into a ...

I am very much new to the DB world, so wanted to review whether I am following right approach or not. I have two tables, table A --> is a table with 40 columns table B --> is a table with the 3 ...

I'm trying to track the revenue generated by a set of users, across time. I have users who signed for a paid subscription and never had a paid subscription before that time of x at the same time they ...

I have this requirement that I need to attach a new column in select statement. It holds a string series of the disp_order of its children. I currently have the SQL statement only for the immediate ...

I am using an application (MapServer - http://mapserver.org/) that wraps SQL statements, so that the ORDER BY statement is in the inner query. E.g. SELECT * FROM ( SELECT ID, GEOM, Name ...

I am attempting to write a query that will be consumed by a SSRS 2012 report. Given a paid invoice, with a certain set of account allocations towards which the money paid towards it must be saved, I ...

I need to delete some rows from one large table. The rows to delete shouldn't be in another table, example: DELETE FROM LargeTable WHERE id IS NOT IN (SELECT DISTINCT foreign_id from EvenLargerTable) ...

Im working with QGIS and Im trying to save a Mapinfo map to Oracle Spatial. The map file is around 1GB and has 700k road segment. The issue is when copy the segements from the source map to the db ...

I am REALLY very new to this so please excuse my ignorance, but I could really use some help! I've got two tables: BillsFiled and Authors On BillsFiled, there are the columns: ID, Symbol, Filedate, ...

Is there a way in Postgres to make some kind of "parametrized view" e.g. the view that uses the same query but on different tables. I would like to simplify the maintenance of the query below. It is ...

Oracle Hints Hints can extend the capability of cost-based optimization. This technique is especially helpful if your distributed query contains an aggregate, subquery, or complex SQL. Indexes ...

Having the following queries, where the first query is returning a field of number of rows found, and the second returns the actual rows: First Query: SELECT count(*) as total FROM individual i ...

I'm trying to create a linked server to an instance of MySQL. I've created a System DSN to the instance and that passes the connection test, but when I try to create a linked server using that data ...

My knowledge with triggers is very poor. I want to create an INSERT/UPDATE/DELETE trigger on a tableA with column names (A1,A2,A3,A4,A5,A6). After the triggers fires, I want to put that data in ...

I'm writing query. I'm worrying about performance. Because table will have huge data. [Schema] CREATE TABLE `contract` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `section_id` int(10) ...

The Issue: I'm working on a big table that consists about 37mln rows. Data include measurements of many devices made in certain time e.g. '2013-09-24 10:45:50'. Each day all of those devices are ...

I have a stored procedure that basically selects values from one table and inserts them to another, a sort of archiving. I want to avoid multiple people from doing that at the same time. While this ...

This is my query ALTER Procedure [dbo].[OpenExcel] @FileName Varchar(2000), @ExcelName Varchar(2000), @SheetName Varchar(100) , @Header Varchar(50) , @...

I want to generate a series of months. The start should be the first month of the current year, the stop is the current date with an interval of 1 month. I used the function generate_series (see ...

I'm looking to find the average interval between successive rows across the whole query - delta-previous in below example: SELECT *, "RecognitionTimestamp" - lag("RecognitionTimestamp") OVER(ORDER ...

I have two tables, users and scores Users +----+--------+ | id | name | +----+--------+ | 1 | John | | 2 | Jane | | 3 | Clarke | +----+--------+ Scores +----+---------+-------+------------...

I have 3 tables: table1: Employee_class(PK), Executive_lounge, Executive_washroom, Supply_closet, Employee_lounge, Server_room, Server_closet table2: Emp_id(PK), LName, Years_of_service, ...

I have 64gb ram on server. InnoDB buffer pool is set to 26.1gb [OK] InnoDB buffer pool / data size: 26.1G/24.3G Im wondering what happens if data over grow current pool size, as i understand it ...

I'm having a hard time wrapping my head around how to best model my relational database. I want to be able to structure it in such a way that a User on my site can create Sub-Users that are able to ...

i need simple SQL to calculate the time diff between Two Consecutive Rows anyone can help

Related tags

Hot questions

Language

Popular Tags