SQL loader when clause conditions to satisfy if a column is starting with certain four digits then skip the row - sql-loader

I am trying to create a SQL loader CTL file and required to ignore rows that are starting with specific number in a column. suppose a column record_id =1211.6540D then ignore the row if the record column value starts with 1211.
I tried with position of numbers but the columns values before the record_id are not constant.
Can you please help.

Related

Mysql - Inserting multiple values into empty column of existing table without specifying all "where" conditions

I have a table in MySQL and I have append a new column to it with emtpy fields.
Now I am wondering if there is a possibility to append multiple rows to only this specific column without specifying the "where" condition for each row because there are many entries I wanted to so
I have something like this
INSERT INTO table.name
(`column.name`) VALUES
(2,
3,
1,
2,
0);
So that for the first row all values for each column stay the same but the value 2 will be appended to that corresponding empty column, for the 2nd row the value 3 will be attached and so on.
So I wanted to add for ALL rows a corresponding value in this new column. So the first value is for the first row, the second value of this new column for the 2nd row and so on
Thank you in advance!

Truncating rows based on column value in mysql

Let's say I have have a MySQL table with many rows that I want to limit in a specific way. Each row has a column, userID, that is indexed but is not unique. Each row also has a datetime column for createDate.
I'd like for the table to never contain more than X number (say, 1000) of rows for a given userID. So, anytime a row is inserted, if that means that there are now greater than X rows where userID = Y then the DB would delete a row based on the value of createDate.
Is this possible to achieve inside the database only? What performance concerns should I have about this kind of approach?

Unwanted row while querying tables

I am querying two tables in the same database, I want to have all lines in both database where there is a match but the query should take only row with max date for each file number from file movement table.
File Details Table
File Movement Table
Here is my current Query
query
The result should not contain the 1st row for file 123 as the 2nd row has the larger issue date
enter image description here
Replace b.issue_date at line 1 of your query with MAX(b.issue_date)
append GROUP BY b.file_number after ON condition at last line before semicolon.
SQL query engine generally applies GROUP BY operation before applying any aggregate function on any of its column specified after SELECT clause while retrieving data.
Therefore, the consequence of the two operations are as follows
result grouped by file_number -> result containing only the max value of issue_date column of file_movement table for each file_number

I need a MySql table column which need to reset to starting value

I am in need of a Mysql Column which will contain values in a certain range. For example, I have a column name called "apiCallCount" value of this column should within a range of 1 to 1000. Also, we needed to make this column as auto incremented(please note the table has a primary key which is auto incremented)
That is, the value of the column("apiCallCount") will be "1" when you insert the first row, it should continue to increment till 1000 as each insertion happen. Next insertion after the value become 1000 should create a row with the value "1" in "apiCallCount" column.
Honourable Dipu, try to use RANGE_MAX column assign it to the number that you wish to be the maximum (which is 1000 according to you query) then make the field to auto increment while you are creating you database.

MySQL and get column headers where cell equals value

I have a SQL table with many columns (40+). The first column is an ID column and the rest are columns which only take values of 0 or 1. Is there a query in which i can search the row and see which "cells" are equal to 1 and return the column name?
For example, say my ID is 5 and columns 4,9,23 each have a 1 for that row (all others are zero). Therefore i would want to return "Column4","Column9" and "Column23" as my result. I need the ID stipulation in there too so I know which row to examine.
Any ideas? Thanks!