This answer is community wiki please provide additional database-specific information at the bottom.
Formatting
When possible do not include screenshots or pictures where text would otherwise do, and even better than text is the necessary SQL to build a test case. If you have the skills to provide test data in a textual grid and in SQL that would be best. For instance, if you're showing 3 rows of test data you could provide the CREATE TABLE AS SELECT
to go along with it.
CREATE TABLE foo
AS
SELECT id, char
FROM ( VALUES
(5,'a'),
(6,'z'),
(7,'d')
) AS t(id,char);
Or even more simply,
CREATE TABLE foo(id,char)
AS VALUES
(5,'a'),
(6,'z'),
(7,'d')
;
This can also be spaced out to and whitespace-aligned.
CREATE TABLE foo AS
SELECT *
FROM ( VALUES
(5, 'col2', 'foo'),
(6, 'foobar', 'bar'),
(7, 'baz', 'baz')
) AS t(id,fooCol,barCol);
PostgreSQL
On Unix, if you have a table with test data you can dump it with,
## We remove comments, and VARIABLE sets
pg_dump -t myTable -d myDatabase -O --inserts | sed -e'/^\(SET\|-\)\|^$/d'
Transact SQL
-- A Table variable will probably be good enough for most cases
DECLARE @TestData TABLE(foo INT, bar NVARCHAR(50));
-- A full table can also be created.
CREATE TABLE TestData(foo INT, bar NVARCHAR(50));
-- Insert data into the table or table variable
INSERT INTO @TestData (foo, bar)
VALUES (1, N'Fizz'), (2, N'Buzz');