Latest questions in Database

0 votes
1 answer

SQL query - Dept and Employee table, some departments may not have managers

Yes, even though I like using JOINs, ...READ MORE

Sep 16, 2022 in Database by narikkadan
• 63,420 points
17,915 views
0 votes
1 answer

Storing images in SQL Server?

Following extensive performance testing and analysis, the ...READ MORE

Sep 16, 2022 in Database by narikkadan
• 63,420 points
744 views
0 votes
1 answer

What does "DISTINCT ON (expression)" do?

The snippet from the Official documentation for PostgreSQL is ...READ MORE

Sep 16, 2022 in Database by narikkadan
• 63,420 points
402 views
0 votes
1 answer

Unpivot with column name

Your inquiry is quite near. The following ...READ MORE

Sep 16, 2022 in Database by narikkadan
• 63,420 points
496 views
0 votes
1 answer

SQL Inner-join with 3 tables?

Try this: SELECT s.studentname , ...READ MORE

Sep 15, 2022 in Database by narikkadan
• 63,420 points
779 views
0 votes
1 answer

SQL Server Error : String or binary data would be truncated

You're trying to write more data than ...READ MORE

Sep 15, 2022 in Database by narikkadan
• 63,420 points
5,282 views
0 votes
1 answer

How do I perform the SQL Join equivalent in MongoDB?

The majority of the responses to this ...READ MORE

Sep 15, 2022 in Database by narikkadan
• 63,420 points
873 views
0 votes
1 answer

LIMIT 10..20 in SQL Server

The LIMIT clause is not included in ...READ MORE

Sep 15, 2022 in Database by narikkadan
• 63,420 points
883 views
0 votes
1 answer

How to extract only the year from the date in sql server 2008?

To obtain the year from the given ...READ MORE

Sep 15, 2022 in Database by narikkadan
• 63,420 points
482 views
0 votes
1 answer

Is there a Boolean data type in Microsoft SQL Server like there is in MySQL?

The BIT datatype can be used to ...READ MORE

Sep 15, 2022 in Database by narikkadan
• 63,420 points
1,807 views
0 votes
1 answer

How can I import an Excel file into SQL Server?

You can use OPENROWSET to import an Excel file ...READ MORE

Sep 15, 2022 in Database by narikkadan
• 63,420 points
1,576 views
0 votes
1 answer

How do I limit the number of rows returned by an Oracle query after ordering?

Use a subquery for this like: select * from ...READ MORE

Sep 15, 2022 in Database by narikkadan
• 63,420 points
1,649 views
0 votes
1 answer

SQL Error: ORA-00922: missing or invalid option

The lack of an underscore between "chartered" ...READ MORE

Sep 15, 2022 in Database by narikkadan
• 63,420 points
1,657 views
0 votes
1 answer

Create enum in SQL Server

Just normalize your model properly: create table user_rank ( ...READ MORE

Sep 15, 2022 in Database by narikkadan
• 63,420 points
14,701 views
0 votes
1 answer

Default SQL Server Port

The default port of SQL server is 1433. READ MORE

Sep 13, 2022 in Database by narikkadan
• 63,420 points
868 views
0 votes
1 answer

What is the use of a cursor in SQL Server?

Instead of receiving a result set as ...READ MORE

Sep 13, 2022 in Database by narikkadan
• 63,420 points
468 views
0 votes
1 answer

SQL Error: ORA-01861: literal does not match format string 01861

Try replacing the string literal for date ...READ MORE

Sep 13, 2022 in Database by narikkadan
• 63,420 points
11,598 views
0 votes
1 answer

ERROR: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it

One of the services has not begun ...READ MORE

Sep 13, 2022 in Database by narikkadan
• 63,420 points
10,615 views
0 votes
1 answer

Fatal error: Call to undefined function sqlsrv_connect()

This helped me get to my answer. There ...READ MORE

Sep 13, 2022 in Database by narikkadan
• 63,420 points
2,616 views
0 votes
1 answer

SQL Server Convert Varchar to Datetime

Try this: SELECT CONVERT(Datetime, '2011-09-28 18:01:00', 120) -- ...READ MORE

Sep 13, 2022 in Database by narikkadan
• 63,420 points
5,232 views
0 votes
1 answer

Oracle SQL Developer: Failure - Test failed: The Network Adapter could not establish the connection?

 There were multiple issues. If you encounter ...READ MORE

Sep 13, 2022 in Database by narikkadan
• 63,420 points
4,593 views
0 votes
1 answer

java.sql.SQLException: IO Exception : The Network adapter could not establish the connection?

As a result of our chat, you ...READ MORE

Sep 13, 2022 in Database by narikkadan
• 63,420 points
4,556 views
0 votes
0 answers

Query comparing dates in SQL

I have a table containing dates for ...READ MORE

Sep 12, 2022 in Database by Kithuzzz
• 38,010 points
644 views
0 votes
1 answer

Error - SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM

This works quite well for SQL min/max dates ...READ MORE

Sep 13, 2022 in Database by narikkadan
• 63,420 points
4,947 views
0 votes
1 answer

How to display databases in Oracle 11g using SQL*Plus

A MySQL "database" can be compared to ...READ MORE

Sep 12, 2022 in Database by narikkadan
• 63,420 points
2,449 views
0 votes
1 answer

How to select from multiple tables without a JOIN ?

Try this: SELECT ... FROM ( SELECT ...READ MORE

Sep 12, 2022 in Database by narikkadan
• 63,420 points
5,387 views
0 votes
1 answer

How can I confirm a database is Oracle & what version it is using SQL?

Run this SQL: select * from v$version; Output: BANNER ---------------------------------------------------------------- Oracle Database ...READ MORE

Sep 12, 2022 in Database by narikkadan
• 63,420 points
353 views
0 votes
1 answer

How do I create a table based on another table

Although CREATE TABLE AS... SELECT does exist ...READ MORE

Sep 12, 2022 in Database by narikkadan
• 63,420 points
536 views
0 votes
1 answer

Using RegEx in SQL Server

Because LIKE can be used instead of managed ...READ MORE

Sep 12, 2022 in Database by narikkadan
• 63,420 points
689 views
0 votes
1 answer

What's the difference between VARCHAR and CHAR?

Any Unicode data can be stored in ...READ MORE

Sep 12, 2022 in Database by narikkadan
• 63,420 points
386 views
0 votes
1 answer

SQL WHERE ID IN (id1, id2, ..., idn)

Option 1 is the only good solution. Why? Option ...READ MORE

Sep 12, 2022 in Database by narikkadan
• 63,420 points
4,958 views
0 votes
1 answer

DB2 SQL error sqlcode=-104 sqlstate=42601

You missed the from clause: SELECT * from TCCAWZTXD.TCC_COIL_DEMODATA WHERE ...READ MORE

Sep 12, 2022 in Database by narikkadan
• 63,420 points
2,989 views
0 votes
1 answer

Add a column with a default value to an existing table in SQL Server

Syntax: ALTER TABLE {TABLENAME} ADD {COLUMNNAME} {TYPE} {NULL|NOT ...READ MORE

Sep 12, 2022 in Database by narikkadan
• 63,420 points
1,997 views
0 votes
1 answer

Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452) in sql 2008

Solution Go to Start > Programs > Microsoft SQL Server > Enterprise Manager. Right-click the SQL ...READ MORE

Sep 12, 2022 in Database by narikkadan
• 63,420 points
831 views
0 votes
1 answer

How to calculate percentage with a SQL statement

The following has passed my tests, and ...READ MORE

Sep 12, 2022 in Database by narikkadan
• 63,420 points
4,738 views
0 votes
1 answer

What are projection and selection?

Projection means choosing which columns (or expressions) the query shall ...READ MORE

Sep 12, 2022 in Database by narikkadan
• 63,420 points
6,020 views
0 votes
1 answer

Add primary key to existing table

You have to drop constraint and recreate ...READ MORE

Sep 12, 2022 in Database by narikkadan
• 63,420 points
360 views
0 votes
1 answer

What datatype should be used for storing phone numbers in SQL Server 2005?

Does this include: International numbers? Extensions? Other information besides the ...READ MORE

Sep 11, 2022 in Database by narikkadan
• 63,420 points
1,295 views
0 votes
1 answer

PL/MySQL does it exist?

Despite the fact that MySQL and PL/SQL ...READ MORE

Sep 11, 2022 in Database by narikkadan
• 63,420 points
1,053 views
0 votes
1 answer

Difference between numeric, float and decimal in SQL Server

use the float or real data types only if the precision provided by decimal (up ...READ MORE

Sep 11, 2022 in Database by narikkadan
• 63,420 points
1,721 views
0 votes
1 answer

java.sql.SQLException: - ORA-01000: maximum open cursors exceeded

The maximum-open-cursors error, also known as ORA-01000, ...READ MORE

Sep 11, 2022 in Database by narikkadan
• 63,420 points

edited Jul 5, 2023 by Khan Sarfaraz 2,732 views
0 votes
1 answer

How to execute function in SQL Server 2008

The function appears not to be being ...READ MORE

Sep 11, 2022 in Database by narikkadan
• 63,420 points
674 views
0 votes
1 answer

Calculate a Running Total in SQL Server

The problem is that the SQL Server ...READ MORE

Sep 11, 2022 in Database by narikkadan
• 63,420 points
1,097 views
0 votes
1 answer

Difference between EXISTS and IN in SQL?

Although the exists keyword can be used ...READ MORE

Sep 11, 2022 in Database by narikkadan
• 63,420 points
539 views
0 votes
1 answer

SQL Server WITH statement

I'm going to guess because I don't ...READ MORE

Sep 10, 2022 in Database by narikkadan
• 63,420 points
404 views
0 votes
1 answer

How to convert date to a format `mm/dd/yyyy`

Your data is already in varchar, thus ...READ MORE

Sep 10, 2022 in Database by narikkadan
• 63,420 points
3,661 views
0 votes
1 answer

Use of contains() in sql server

The straightforward method is shown here. You ...READ MORE

Sep 10, 2022 in Database by narikkadan
• 63,420 points
550 views
0 votes
1 answer

SQL keys, MUL vs PRI vs UNI

It denotes that the field is (a ...READ MORE

Sep 10, 2022 in Database by narikkadan
• 63,420 points
1,087 views
0 votes
1 answer

How can I use LTRIM/RTRIM to search and replace leading/trailing spaces?

Use LTRIM/RTRIM to eliminate spaces from the ...READ MORE

Sep 10, 2022 in Database by narikkadan
• 63,420 points
811 views
0 votes
1 answer

Get list of databases from SQL Server

Execute: SELECT name FROM master.sys.databases I hope this helps ...READ MORE

Sep 10, 2022 in Database by narikkadan
• 63,420 points
344 views