Most Popular
1500 questions
67
votes
7 answers
Connect with sqlplus from the command line using a connection string
Let's say I have an Oracle database. I have a username = x, password = y, database = z, port = a, SID = b, and Hostname = c.
So, how do I connect correctly? I used many options like:
sqlplus…
Edvinas
- 671
- 1
- 6
- 3
67
votes
4 answers
How to run recurring tasks on Postgresql without an external cron-like tool?
I would like to call a stored procedure on a regular basis. On Oracle, I would create a job for this. I have found that Postgresql can mimic this well by using an external tool (cron etc) and PgAgent.
Do you know of an "internal" alternative which…
Stephan
- 1,463
- 4
- 18
- 26
67
votes
3 answers
How to view data in pgAdmin III
I can't believe they make it this hard. I am at a loss about how to view the data in my database.
Is there an easy way to see what data is in my tables with pgAdmin III? Alternatively, is there a program that I could use that does not suck?
Alexis K
- 789
- 1
- 5
- 5
66
votes
3 answers
How to grant super privilege to the user?
I have created a user and given privileges to the user1.
`grant all privileges on db1.* to user1@'%' with grant option;
Am using mysql workbench to import dumps to my database. While importing dumps to database db1,error occurs stating that
ERROR…
delete my account
- 771
- 2
- 6
- 6
66
votes
8 answers
What is the difference between a "record" and a "row" in SQL Server?
There was a rather innocuous question about adding dates and times in SQL Server that set off a rather fascinating taxonomic debate.
So how do we differentiate between these related terms and how we use them properly?
Row
Record
swasheck
- 10,665
- 4
- 47
- 88
66
votes
3 answers
When to use views in MySQL?
When creating tables from multiple joins for use in analysis, when is it preferred to use views versus creating a new table?
One reason that I would prefer to use views is that the database schema has been developed by our administrator from within…
David LeBauer
- 3,142
- 8
- 30
- 34
66
votes
8 answers
ERROR: no schema has been selected to create in
I am working on an amazon RDS postgresql database where I know there had been some issue with the public schema (maybe it was dropped). But apparently the schema exists, and anyway the problem is not solved. Here is a sample session with a newly…
Emanuele Paolini
- 763
- 1
- 5
- 7
65
votes
3 answers
Find highest level of a hierarchical field: with vs without CTEs
note: this question has been updated to reflect that we are currently using MySQL, having done so, I would like to see a how much easier it would be if we switched to a CTE-supporting database.
I have a self-referencing table with a primary key, id…
David LeBauer
- 3,142
- 8
- 30
- 34
65
votes
3 answers
Can't rename columns in PostgreSQL views with CREATE OR REPLACE
In PostreSQL 8.3, I'm trying to create a view which will look just like an existing table but have different column names.
This works
CREATE OR REPLACE VIEW gfam.nice_builds AS
SELECT (family_tree.family_tree_id) as x,
…
Aleksandr Levchuk
- 1,187
- 1
- 9
- 11
65
votes
4 answers
Does SQL Server CASE statement evaluate all conditions or exit on first TRUE condition?
Does the SQL Server (2008 or 2012, specifically) CASE statement evaluate all the WHEN conditions or does it exit once it finds a WHEN clause that evaluates to true? If it does go through the entire set of conditions, does that mean that the last…
Juan Velez
- 3,255
- 17
- 52
- 72
65
votes
5 answers
Write differences between varchar and nvarchar
Currently in our SQL Server 2012 database, we're using varchar, and we'd like to change that nvarchar. I've generated a script to do that.
My question is are there any differences in how SQL Server writes to varchar columns vs. nvarchar columns? We…
Chris L
- 933
- 1
- 7
- 10
64
votes
1 answer
What event information can I get by default from SQL Server?
I often see questions where people want to know if a certain thing happened, or when it happened, or who performed the action. In a lot of cases, SQL Server just doesn't track this information on its own. For example:
Who last executed stored…
Aaron Bertrand
- 180,303
- 28
- 400
- 614
64
votes
2 answers
How to view the current settings of Autovacuum in Postgres?
I've found a million examples of how to set Autovacuum's configuration settings, but can't seem to find how to list the current configuration.
Postgres 9.1 is the version I'm most interested in.
Peter Groves
- 1,125
- 2
- 9
- 7
64
votes
8 answers
Is it possible to quickly create/restore database snapshots with PostgreSQL?
First of all, I'm a developer, not a DBA or sysadmin; please be gentle :)
I'm working on an application workflow where a single user action will trigger complex changes in the database - creating hundreds of records in some tables, updating hundreds…
Zilk
- 1,111
- 2
- 9
- 12
64
votes
7 answers
What are the differences between "Stored Procedures" and "Stored Functions"?
So a comment to this question mentions, that there is a slight difference between "Stored Procedures" and "Stored Functions" in PostgreSQL.
The comment links to a Wikipedia article but some of this don't seem to apply (e.g. that they can be used in…
DrColossos
- 7,187
- 2
- 32
- 30