Check the constraint in Oracle SQL Developer

need your help I have a table in Oracle SQL Developer of this kind: Issue ID|Subscriber_ID|Book_ID| Taken |Returned --+-------------+-------+--------+-------- 1 | 1 | 2 |01-06-16|05-06-16 2 | 3 | 5 |07-05-16| (null) 3 | 2 | 2 |06-06-16| (null) 4 | 1

Remove '$' from the output

I am having the column as price, where entries are $3000,$4500 and so on. I want to remove the dollar $ like it should only print 3000,4000 etc. How to achieve his?This should work UPDATE your_table SET your_column = REPLACE(your_column,'$','')

Find users who only have read permissions

I have a database table with three columns: The user, the filename and the permission (enumeration for "read","write","delete"). I don't get any further with the question: How to find all the user_ids which have ONLY the righ

not such a column: 498 (code 1):

I translated my app using android studio translation editor, i get this error when running my application on android phone using Arabic as its language: android.database.sqlite.SQLiteException: no such column: ٤۹۸ (code 1): , while compiling: SELECT

SQL C # ASP NET connection string

So I'm working on making a submit content page that will store the users input into a database, here is the code I have so far: protected void submitData_Click(object sender, EventArgs e) { string userId = HttpContext.Current.User.Identity.Name; int

Any way to substitute the left join or is it necessary?

I would like to know if there is any better way to do the following query or if there is any necessity to make it better? (Considering that the DB load is not that big). The only criterion is that the 3 "variables" have to be included as AND, an

Delete the last two characters of each database value

I run the following query: select * from my_temp_table And get this output: PNRP1-109/RT PNRP1-200-16 PNRP1-209/PG 013555366-IT How can I alter my query to strip the last two characters from each value?Use the SUBSTR() function. SELECT SUBSTR(my_colu

shows the line with the group max by with two columns sql

lots of variations of this questions have been asked but can't seem to find the right one for my table. i have three columns pd, stm, and salesincrease. i want to find the max of salesincrease for each stm. pd stm salesincrease Chamomile Central 801

Get the sum of a column based on another column

I have the following first three columns of data in a select statement, I am trying to add the "total" column: Customer ReportingCategory SumOfProfit Total ABC 1 10 60 ABC 2 25 60 ABC 4 25 60 So right now, I am basically selecting Customer, Repo

Convert the list string to a Python list

This question already has an answer here: Converting a string to a tuple in python 3 answers I downloaded a csv table from a database using SQL. One of the fields has values like so: '[0.1234,0.0,0.0]' I want to convert this string to a python list t

Split a store SQL object into separate tables

My SQL Query give me error output all time with the following queries. can i set queries while fetching the results? $con = new connection(); $con = mysql_query("SELECT * FROM object"); while($res = mysql_fetch_array($con)) { mysql_query("I

Optimal SQL query help please

I have two tables: Actions Hosts Sample data for the tables is as below: Actions | ID (bigint) | ACTION_TIME (datetime) | ACTION_NAME (varchar) | ----------------------------------------------------------------------- | 1 | 2013-08-03 04:42:55 | test

Very ugly SQL GROUP BY

Daylight savings calculation. We do have a very ugly working model below. Have seen this - SQL - Ugly combination of GROUP BY and COALESCE If we can set variables.. This does not work - also, have removed the count(*) to illustrate the issue we are s

The SQL IN query produces a strange result

Please see the table structure below: CREATE TABLE Person (id int not null, PID INT NOT NULL, Name VARCHAR(50)) CREATE TABLE [Order] (OID INT NOT NULL, PID INT NOT NULL) INSERT INTO Person VALUES (1,1,'Ian') INSERT INTO Person VALUES (2,2,'Maria') IN

Cursor to extract the dataset to take AVERAGE and STDEV

I have objects being made from a template. There are several datapoints on these objects, and I measure each datapoint on every part to see how far off of the template the parts are. I want to take the most recent 100 measurements and find their aver

Update multiple tables in SQL Server by using INNER JOIN

This question already has an answer here: How to update two tables in one statement in SQL Server 2005? 7 answers I'm using SQL Server and trying to use SQL to update multiple tables at once with one query: The following query: update table1 set A.OR

Get the extension of a file using SQL?

Possible Duplicate: Get substring in SQL Server Let's say I have MyImage.png or MyDoc.doc, etc in a column in a database table. How can I only get the file extension?try this: declare @str varchar(20)='MyDoc.doc'; select reverse(left(reverse(@str),ch

Incremental primary key in the mySQL table with PHP

I'm attempting to use a form post to add rows to a mySQL table. Each row has a primary I'm calling quoteID. When a new form is submitted, it should add itself as a row in the table, with a quoteID of one greater than the previous quoteID. It current

How to cut a part of a string in MySQL?

In MySQL, I have a text column with "bla bla bla YYY=76767 bla bla bla". I need to cut the number 76767. How can I do it in SQL?You can use select substring_index(substring(mycol, instr(mycol, "=")+1), " ", 1) to get the firs

Add a large number of rows using SQL

My code works well when I'm adding less than 30 rows. But It can't handle more than that. How can I overcome this? I get this error:Unspecified error when I'm trying to add less than 30, all the rows are added. and when I'm trying to add more than 30

Mysql reset id field

This question already has an answer here: Auto Increment Problem in Mysql 4 answers I'm wondering is it possible to reset id field, let's say now i have 5000 records and id is auto incrementing and after some time i deleted some records so now it's g

SSIS: loss of SQL 2008 R2 data to MySQL

I have an SSIS package set up to export data from a SQL Server 2008 R2 table to a MySQL version of that table. The package executes however, I am getting about 1% of the rows failing to be exported. My source connection uses the SQL statement SELECT

Postgres nested if in case request

Could you tell my why the following isnt working in postgres sql?: See updated code below UPDATE: I expect the query to return "0.30" as float. This construct is only for testing purposes, i have some complex querys which depend on this conditio

Delete the user from the SQL Server database?

How can I drop user from a database without dropping it's logging? The script should check if the user exists in database, if does then drop the user.Is this what you are trying to do?? IF EXISTS (SELECT * FROM sys.database_principals WHERE name = N'

SQL - Difference between these joins?

I should probably know this by now, but what, if any is the difference between the two statements below? The nested join: SELECT t1.* FROM table1 t1 INNER JOIN table2 t2 LEFT JOIN table3 t3 ON t3.table3_ID = t2.table2_ID ON t2.table2_ID = t1.table1_I

The first two uppercase characters of a column in a db table

I've got a column in a database table (SQL Server 2005) that contains data like this: TQ7394 SZ910284 T r1534 su8472 I would like to update this column so that the first two characters are uppercase. I would also like to remove any spaces between the