245 Answered Questions for the topic SQL

05/29/19

django test app error - Got an error creating the test database: permission denied to create database?

When I try to test any app with command (I noticed it when I tried to deploy myproject using fabric, which uses this command): python manage.py test appname I get this error: Creating test... more

How to write a simple database engine?

I am interested in learning how a database engine works (i.e. the internals of it). I know most of the basic data structures taught in CS (trees, hash tables, lists, etc.) as well as a pretty good... more
Sql

05/19/19

Detect if value is number in MySQL?

Is there a way to detect if a value is a number in a MySQL query? e.g., `SELECT * FROM myTable WHERE isANumber(col1)=true`
Sql

05/18/19

MySQL "between" clause not inclusive?

If I run a query with a `between` clause, it seems to exclude the ending value. For example: select * from person where dob between '2011-01-01' and '2011-01-31' This gets all results with... more
Sql

05/17/19

Getting date in format 20 Mar 2018 (Tue)?

How can I display date as dd MMM yyyy (ddd) in SSRS? Thanks!
Sql

05/15/19

Is is possible for SSRS to query a sharepoint view rather than a list?

Is is possible for SSRS to query a sharepoint view rather than a list ?
Sql

05/15/19

Reporting Services - hide table column based upon report parameter?

I have a report in Reporting Services 2005, and I want to hide or show a single table column based upon a report parameter. Does anyone have any idea how to do that? Thanks!
Sql

05/15/19

hide/remove header and footer?

How I want remove header and footer in SSRS for the last 6 page. Thank You
Sql

05/15/19

How to find the last time a particular report was run?

I'm using SSRS 2016. I want to find out the last time a particular report was run. Is this something I can easily query on the ReportServer database? Thanks!
Sql

05/15/19

Calculate fiscal year in SQL Server?

How would you calculate the fiscal year from a date field in a view in SQL Server?
Sql

05/14/19

MYSQL Update Statement Inner Join Tables?

I have no idea what the problem is. Using MySQL 5.0 i get a compile error when attempting to run the following MYSQL update statement UPDATE b SET b.mapx = g.latitude, b.mapy =... more
Sql

05/14/19

Convert a string to int using sql query?

How to convert a string to integer using SQL query on SQL Server 2005?
Sql

05/14/19

How to find current transaction level?

How do you find current database's transaction level on SQL Server?
Sql

05/13/19

How to create composite primary key in SQL Server 2008?

I want to create tables in SQL Server 2008, but I don't know how to create composite primary key. How can I achieve this?
Sql

05/13/19

How can I customise error messages in SSRS?

I have SSRS Report being accessed from a Report Server. Is there any way I can give an error message of my own, if my report fails to open there?
Sql

05/13/19

How to return only the Date from a SQL Server DateTime datatype?

SELECT GETDATE() Returns: <code>2008-09-22 15:24:13.790</code> I want that date part without the time part: <code>2008-09-22 00:00:00.000</code> How can I get that?
Sql

05/12/19

Use variable with TOP in select statement in SQL Server without making it dynamic?

declare @top int set @top = 5 select top @top * from tablename Is it possible? Or any idea for such a logic (i don't want to use dynamic query)?
Sql

05/12/19

How do I perform an IF...THEN in an SQL SELECT?

How do I perform an `IF...THEN` in an `SQL SELECT` statement? For example: SELECT IF(Obsolete = 'N' OR InStock = 'Y' ? 1 : 0) AS Saleable, * FROM Product
Sql

05/12/19

SELECT DISTINCT on one column?

Using SQL Server, I have... ID SKU  PRODUCT ======================= 1 FOO-23 Orange 2 BAR-23 Orange 3 FOO-24 Apple 4 FOO-25 Orange I want 1 FOO-23 Orange 3 FOO-24 Apple This... more
Sql

05/12/19

How to reset AUTO_INCREMENT in MySQL?

How can I ***reset*** the `AUTO_INCREMENT` of a field? I want it to start counting from `1` again.
Sql

05/10/19

How to randomly select rows in SQL?

I am using MSSQL Server 2005. In my db, I have a table "customerNames" which has two columns "Id" and "Name" and approx. 1,000 results. I am creating a functionality where I have to pick 5... more
Sql

05/10/19

How do I set a column value to NULL in SQL Server Management Studio?

How do I clear the value from a cell and make it NULL?
Sql

05/09/19

MySQL/SQL: Group by date only on a Datetime column?

Having a table with a column like: `mydate DATETIME` ... I have a query such as: SELECT SUM(foo), mydate FROM a_table GROUP BY a_table.mydate; This will group by the full `datetime`, including... more
Sql

05/09/19

Alter a MySQL column to be AUTO_INCREMENT?

I’m trying to modify a table to make its primary key column `AUTO_INCREMENT` after the fact. I have tried the following SQL, but got a syntax error notification. <!-- language: lang-sql... more
Sql

05/08/19

How to select date without time in SQL?

When I select date in SQL it is returned as `2011-02-25 21:17:33.933`. But I need only the Date part, that is `2011-02-25`. How can I do this?

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.