Help me understand this: In the sqlzoo tutorial for question 3a ("Find the largest country in each region"), why does attaching 'AND population > 0' to the nested SELECT statement make this correct?
...
Hi everyone,
I'm fairly new to sql and was hoping that someone can help me with an update query. I have a users table with group_id (foreign key), user_id and user_index columns. There are multiple users corresponding to each individual group_id, and user_id is a serial column which goes from 1 to the table size.
I'm looking for a quer...
I have several mysql tables in a database.
Currently I am doing finishing test on my website, and one is to test a heavy db to see how much this affects performance (searching).
The website is a classifieds website.
It would take a very long time for me to insert one classified at a time to reach a significant nr.
So I wonder, is ther...
I have successfully configured a principal and mirror with SQL Server 2008 and Windows Server 2008 R2 64bit. However, when I attempt to add a witness (SQL Server 2005 and Windows Server 2003 32bit) to the mix, I get the following errors in the event log of the primary: EventID 1456 "The ALTER DATABASE command could not be sent to the rem...
We have been using several nested queries for reporting purposes since the days of SQL Server 2000.
select * from
(select * from t1) t1
inner join
(select * from t2) t2
on........
We recently upgraded our database to SQL Server 2008 Standard from SQL Server 2000 Enterprise. We are noticing some of those old queries are now runn...
There are a few of these around, but I am either slow tonight or I am trying to do something not possible. I have this setup
`id` int(11) NOT NULL AUTO_INCREMENT,
`score` float NOT NULL,
`userId` int(11) NOT NULL
`movieId` int(11) NOT NULL
Taking that into account, I want to get a percentage of all the experiences from all the users i...
I have Following structure
Col1 Col2 Col3
---------------
F P R1
F P R2
F P R3
F P R4
Col3 values can be any thing
Now I want in following format only top 3
Col1 Col2 Res1 Res2 Res3
------------------------------
F P R1 R2 R3
...
When I run the profiler while running my application, it only seems to show SELECTs, not INSERTs or anything that changes the database. Yet my database is being updated, so those commands must be being executed. What do I have to do to get it to show updates? (I am using Entity Framework, btw, if that might make a difference.)
...
Hi,
I was wondering if there is any way to check the execution logs of SQL server. I am not talking about the proprietary transactions logs or the error logs. But just the recently executed logs in a verbose fashion for debugging.
For example, I have a web application that calls stored procedures, passes in parameters and populates gri...
When learning the C# language. With all the applications being developed these days. Would I be better off focusing on windows forms development or WPF development. I want to develope software that uses ADO.net for SQL Server database access. Also stand alone applications to integrate with Microsoft Office to create charts and graphs etc...
I want to update the code on all my record to what they currently are plus _standard any ideas?
So for example if the codes are apple_1 and apple_2 I need them to be apple_1_standard and apple_2_standard
Before:
id code
------------
1 apple_1
1 apple_2
Psuedo Query:
update categories set code = code + "_standard" where i...
i want to find a number of clients from certain dates before and after there was a status changes in their credit history. eg:
date = 2010/07/25
date2 = 2010/08/30
i want everyone from the table who had a status "pending" before "date"
and from the same lists of people, i want to identify lists of clients whose status changed from "p...
I have 2 tables like this
Table 1
Id f1 f2
1 ABC red,green
2 DEF blue,yellow
Table 2
id color value
1 red r
2 green g
3 blue b
4 yellow y
How Can I get result like this
f1 f2 values
ABC red,green r,g
DEF blue,yellow b,y
Thanks i...
Is it a way to retrieve the view's column description from the base table (fn_listextendedproperty)?
The following syntax only list down the column name from the view
SELECT *
FROM sys.columns c
JOIN sys.views v on c.OBJECT_ID = V.OBJECT_ID
JOIN sys.schemas s ON s.schema_id = v.schema_id
and V.NAME = 'v_P...
I would like to know which format SQL Server saves datetimes, GMT or UMT?
...
Hello,
I am having a table structure like this:
Table : emp_details
id name value
1 phone 123-456-8765
1 address Toronto
1 age 25
1 sex male
1 firstname victor
Table:emp
id
1
2
3
4
.
.
.
I want the name value pair to be presented in a flat way:
I am doing it in this naive implemen...
Say I have this:
class Post < ActiveRecord::Base
has_many :relationships, :as => :parent
has_many :images, :through => :relationships
end
class Relationship
belongs_to :parent, :polymorphic => true
belongs_to :child, :polymorphic => true
end
class Image < ActiveRecord::Base
has_many :relationships, :as => :child
has_many :...
Hello
I'm trying to print out Tables from the DB that have the EntityId column equals to DataclassId column here is the code
public void getRootTables_checkSP()
{
string connect = "Data Source= EUADEVS06\\SS2008;Initial Catalog=TacOps_4_0_0_4_test;integrated security=SSPI; persist security info=False;Trusted_Connection=...
I want to lock one record and then no one may make changes to that record. When I release the lock, then people may change the record.
In the meantime that a record is locked, I want to show the user a warning that the record is locked and that changes are not allowed.
How can I do this?
I've tried all the IsolationLevel levels, but ...
I have the week number and year as separate fields in MySQL, how do I compute the last day of the week(Sunday) in the given year?
...