DESC table_name Above SQL allows me to get the table description in PHPMyAdmin. I want to export it to a text file or word file for the documentation. Is there a possible way to do it. Thanks.
Tag: sql
How to count occurrences of a node in SQL XML?
I am trying to do a count on the number of occurrences of the “Colors” node but have been so far unsuccessful. Below is what I have tried so far. If I have the following logic: I get the following error: Msg 2389, Level 16, State 1, Line 50 XQuery [value()]: ‘value()’ requires a single…
Where to place limit clause?
I am trying to place a limit clause on the database query to only show the first 4 results. The current code I am working with is $categories_query = “select c.categories_id, cd.categories_name, …
Duplicate postgresql schema including sequences
My database layout needs to create new schema for each new customer. Currently I use internal function I found on the net and modified a little bit. CREATE FUNCTION copy_schema( source_schema …
SQL Server query to show summary list for particular months or between dates
I have an attendance table which contains student’s attendance date and attendance status. Is there any way to display a summary something like this: Student 20-09-2012 21-09-2012 22-09-2012 23-09-…
How to do NULLS LAST in SQLite?
I’d like to sort my result with all NULL columns last (NULLS LAST), as specified in the SQL:2003 extension T611. Sadly, SQLite seems to not support it. Is there a clever workaround?
Inserting NULL into MySQL timestamp
I’m observing unexpected behavior with inserting/updating NULL in a MySQL timestamp column. Consider the following statements. The first insert (when hiredate is not specified in the SQL, hireDate is null(0) which is expected. However when an explicit null passed in SQL, the current date time is inserte…
Return value at max date for a particular id
Here’s my sql server table This seems like it should be easy to do, but I don’t know why I’m stuck. I’d like to select ONLY the max(date) and value at that max(date) for each id. I want to ignore all other dates that aren’t the max(date) with respect to each id. Here’s what…
Trigger and update to a row in SQL Server after it’s been updated
Is this the best way to keep a simple track of changes to a database row: So any update to a row in [121s] will result in the modified column being updated. It works, but I’m not sure if it’s the best way to achieve this. I’m a litle confused over this line: …and how it knows it’…
cannot get simple PostgreSQL insert to work
I’m trying to do a simple insert into a postgres table, but am getting an error that the value I’m trying to insert is being interpreted as a column name Where id is set up to be the primary key, and auto increment, and not null. Those are the boxes I ticked when I set up the table in phpPgAdmin.