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,700 points
18,652 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,700 points
792 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,700 points
424 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,700 points
532 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,700 points
831 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,700 points
5,393 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,700 points
937 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,700 points
936 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,700 points
527 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,700 points
1,926 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,700 points
1,641 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,700 points
1,729 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,700 points
1,741 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,700 points
15,372 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,700 points
994 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,700 points
494 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,700 points
12,259 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,700 points
11,077 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,700 points
2,720 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,700 points
5,432 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,700 points
4,753 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,700 points
4,758 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
677 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,700 points
5,122 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,700 points
2,645 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,700 points
5,532 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,700 points
404 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,700 points
574 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,700 points
723 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,700 points
415 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,700 points
5,355 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,700 points
3,145 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,700 points
2,083 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,700 points
876 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,700 points
4,952 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,700 points
6,345 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,700 points
381 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,700 points
1,357 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,700 points
1,093 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,700 points
1,859 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,700 points

edited Jul 5, 2023 by Khan Sarfaraz 2,852 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,700 points
717 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,700 points
1,198 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,700 points
591 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,700 points
450 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,700 points
3,734 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,700 points
621 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,700 points
1,175 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,700 points
864 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,700 points
376 views