MySQL - Does a Table have a Specific Column Name

SQL
I can find numerous search results explaining how to search the database or information schema for a specific column name (example). Is there a query...
3 years ago

How do I put all the dates from a table in a new column as I use 'select' in MySQL?

SQL
I have a a SQL query SELECT student.`firstname` AS student_firstname, student.`lastname` AS student_lastname, DATE_FORMAT(attendance.`date`, '%M %...
3 years ago

Mysql - Alter a column to be AUTO_INCREMENT

SQL
I'm trying to modify a table to make it's primary key column AUTO_INCREMENT after the fact. I have tried the following sql, but got a syntax error: ...
3 years ago

select all duplicates from a table in postgres

SQL
Is there a simple way to select all duplicates from a Postgres table? No need for joins or anything fancy. Everything I find on stack is about joins a...
3 years ago

MySQL : show constraints on tables command

SQL
I have tables that I've tried setting PK FK relationships on but I want to verify this. How can I show the PK/FK restraints? I saw this manual page, b...
3 years ago

Mysql Database Design A Complex Shopping Catalogue Part

SQL
I want to make an anouncement system. But i messed the database design part. The system will have unlimited categories and their items so every categ...
3 years ago

Return a substring from a specified string in SQL Server

SQL
I've below query: DECLARE @url varchar (max)='http://v.mercola.com/blogs/public_blog/New-Diet-Pill-Expands-1-000-Times-in-Your-Stomach-24728.aspx' S...
3 years ago

How can I join all the record obtained by a select on a table with the records of another table?

SQL
I am pretty new in SQL and I have the following problem trying to implement the following query on a MySql database. So I have this situation: Into ...
3 years ago

Cast ExecuteScalar result to a GUID with out using a string?

SQL
How can I cast the result of an ExecuteScalar command to a GUID structure without first using .ToString() to pass to the constructor of the GUID? The...
3 years ago

how to join two tables and return 0 if value is not exists?

SQL
I have a two table, hours and messages hours table have only one column hour and 0~23 values inserted. messages table have hour column too. and I'm...
3 years ago

Update column if another column contains a string

SQL
I have a table that contains three columns. column1 column2 column3 mytestdata test myotherdata test I want to insert 'somestr...
3 years ago

Really hard time understanding this query

SQL
The following query is supposed to return "sailors who have reserved all boats" and here's the mySQL code SELECT S.sname FROM Sailors S WHERE NOT EX...
3 years ago

sql query - select on two tables which used data from both tables to filter results

SQL
I have two tables with the following columns: tbl_a: id, date, data tbl_b: id, date, a_id, data in tbl_b.a_id saved the id of tbl_a related record ...
3 years ago

How to delete duplicate records from a table in oracle

SQL
select * from ap; select name from ap group by name having count(*)>1; I want to delete duplicates records from this table. ...
3 years ago

How do you do date math that ignores the year?

SQL
I am trying to select dates that have an anniversary in the next 14 days. How can I select based on dates excluding the year? I have tried something l...
3 years ago

cannot drop table users because other objects depend on it

SQL
I want to drop my tables in database. But, when I use, for example, DROP TABLE if exists users; I receive this message: cannot drop table users be...
3 years ago

change string in php after getting it from mysql database

SQL
I have following data: $var = $_POST['name']; then $var="jay's Box" change to: $var = "jay\'s box" How to do that? ...
3 years ago

Trouble with sql columns

SQL
I've got 2 tables in Database (MS Access) (Fruits and Vegetables). Each of them has fields "Date" and "Value". It is possible to have a few rows with ...
3 years ago

How to create a oracle view of the max sum of a sum of values of a column based on the values of another

SQL
I need to create a view in Oracle 11g that would take these tables: employees FirstName | LastName | EmployeeID -----------------------------------...
3 years ago

CakePHP Tree behavior error

SQL
The actual error I'm getting: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to ...
3 years ago