How does a SQL query work? How does it get compiled? Is the from clause compiled first to see if the table exists? How does it actually retrieve data from the database? How and in what format are the tables stored in a database? I am using phpmyadmin, is there any way I can peek into the files where data
Tag: sql
Is there a command to test an SQL query without executing it? ( MySQL or ANSI SQL )
Is there anything like this: TEST DELETE FROM user WHERE somekey = 45; That can return any errors, for example that somekey doesn’t exist, or some constraint violation or anything, and reporting …
How does contains() in PL-SQL work?
Have a lot of unnecessary results using contains() method in my query. Don’t tell me to use like or something else. It is hardcoded and couldn’t be changed. Answer Contains is used on text fields that have a ‘CONTEXT Index’, which indexes a text field for searching. The standard usage …
Using group by on multiple columns
I understand the point of GROUP BY x. But how does GROUP BY x, y work, and what does it mean? Answer Group By X means put all those with the same value for X in the one group. Group By X, Y means put all those with the same values for both X and Y in the one group.
SQL server query to get the list of columns in a table along with Data types, NOT NULL, and PRIMARY KEY constraints
I need to write a query on SQL server to get the list of columns in a particular table, its associated data types (with length) and if they are not null. And I have managed to do this much. But now i also need to get, in the same table, against a column – TRUE if that column is a
practicing WHERE and HAVING in SQL
here is the schema: alt text http://img30.imageshack.us/img30/3324/123vk.jpg here is the question: Point out the battles in which at least three ships from the same country took part. here is my …
Does AdventureWorks db have tutorials / exercises? [closed]
I downloaded and installed AdventureWorks db for sql server 2008. Are there any exercises or tutorials for it? I’d like to to practice SQL select statements
How can I reset an MySQL AutoIncrement using a MAX value from another table?
I know this won’t work. I tried it in various forms and failed all times. What is the simplest way to achieve the following result? This is great for automation projects. Answer Use a prepared statement:
SQL: difference between PARTITION BY and GROUP BY
I’ve been using GROUP BY for all types of aggregate queries over the years. Recently, I’ve been reverse-engineering some code that uses PARTITION BY to perform aggregations. In reading through all the documentation I can find about PARTITION BY, it sounds a lot like GROUP BY, maybe with a little e…
How to find unused tables in SQL Server
Is there a way of finding out when the data was last entered into a table? I’m trying to find obsolete tables within my database and would like to know if there is a simple script(s) that I can run? Answer You could try check the results of querying the sys.dm_db_index_usage_stats Dynamic Management Vie…