Tutorial by Examples: column

CREATE TABLE stack( id INT, username VARCHAR(30) NOT NULL, password VARCHAR(30) NOT NULL ); INSERT INTO stack (`id`, `username`, `password`) VALUES (1, 'Foo', 'hiddenGem'); INSERT INTO stack (`id`, `username`, `password`) VALUES (2, 'Baa', 'verySecret'); Query SELECT id FROM ...
Query SELECT * FROM stack; Result +------+----------+----------+ | id | username | password | +------+----------+----------+ | 1 | admin | admin | | 2 | stack | stack | +------+----------+----------+ 2 rows in set (0.00 sec) You can select all columns from one table...
Given a file using ; as a column delimiter. Permuting the first and the second column is accomplished by awk -F';' -v 'OFS=;' '{ swap = $2; $2 = $1; $1 = swap; print }'
Given a file using ; as a column delimiter. We compute the mean of the values in the second column with the following program, the provided input is the list of grades of a student group: awk -F';' '{ sum += $2 } END { print(sum / NR) }' <<EOF Alice;2 Victor;1 Barbara;1 Casper;4 Deborah;...
We assume a file using ; as a column delimiter. Selecting a specific set of columns only requires a print statement. For instance, the following program selects the columns 3, 4 and 7 from its input: awk -F';' -v 'OFS=;' '{ print $3, $4, $7 }' It is as usual possible to more carefully choose lin...
Given a file using ; as a column delimiter. We compute the median of the values in the second column with the following program, written for GNU awk. The provided input is the list of grades of a student group: gawk -F';' '{ sample[NR] = $2 } END { asort(sample); if(NR % 2 == 1) { p...
If you want to delete rows (or columns) in a loop, you should always loop starting from the end of range and move back in every step. In case of using the code: Dim i As Long With Workbooks("Book1").Worksheets("Sheet1") For i = 1 To 4 If IsEmpty(.Cells(i, 1)) Then...
#Insert a row before/after line 22 $Sheet->Rows("22:22")->Insert(xlUp, xlFormatFromRightOrBelow); $Sheet->Rows("23:23")->Insert(-4121,0); #xlDown is -4121 and that xlFormatFromLeftOrAbove is 0 #Delete a row $Sheet->Rows("22:22")->Delete(); ...
When creating tables it is possible to declare a column as nullable or non-nullable. CREATE TABLE MyTable ( MyCol1 INT NOT NULL, -- non-nullable MyCol2 INT NULL -- nullable ) ; By default every column (except those in primary key constraint) is nullable unless we explicitly set ...
SELECT * FROM Cars WHERE status IN ( 'Waiting', 'Working' ) This is semantically equivalent to SELECT * FROM Cars WHERE ( status = 'Waiting' OR status = 'Working' ) i.e. value IN ( <value list> ) is a shorthand for disjunction (logical OR).
Bootstrap's grid system has 12 units known as Columns that can be used to layout content horizontally across the viewport. The reason for a 12-unit grid (instead of 10, 16, etc..) is that 12 evenly divides into 6 (halves), 4 (quarters) and 3 (thirds). This makes adapting to a variety of layouts muc...
Sometimes, you may have a list structure that looks like this: Animal Listing Table NameTypeDescriptionTitleString (Text)Name of the animalAgeNumberHow old the animal isValueCurrencyValue of the animalTypeLookup (Animal Types Table)Lookup Field (Gives dropdown of choices from Animal Types Table) ...
class MyDataObject extends DataObject { private static $db = array( 'Name' => 'Varchar' ); private static $has_one = array( 'OtherDataObject' => 'OtherDataObject' ); private static $summary_fields = array( 'Name', 'OtherDat...
It's easier to implement some UDFs on the worksheet if full column references can be passed in as parameters. However, due to the explicit nature of coding, any loop involving these ranges may be processing hundreds of thousands of cells that are completely empty. This reduces your VBA project (and ...
SELECT name, caption as title, year, pages FROM books UNION SELECT name, title, year, 0 as pages FROM movies When combining 2 record sets with different columns then emulate the missing ones with default values.
An array column is supported by PostgreSQL. Rails will automatically convert a PostgreSQL array to a Ruby array, and vice-versa. Create a table with an array column: create_table :products do |t| t.string :name t.text :colors, array: true, default: [] end Add an array column to an existi...
public class Person { public int PersonID { get; set; } [Column("NameOfPerson")] public string PersonName { get; set; } } Tells Entity Framework to use a specific column name instead using the name of the property. You can also specify the database data type a...
ALTER TABLE fish_data.fish DROP PRIMARY KEY; ALTER TABLE fish_data.fish MODIFY COLUMN fish_id DECIMAL(20,0) NOT NULL PRIMARY KEY; An attempt to modify the type of this column without first dropping the primary key would result in an error.
When storing JSON documents in SQL Server, We need to be able to efficiently filter and sort query results on properties of the JSON documents. CREATE TABLE JsonTable ( id int identity primary key, jsonInfo nvarchar(max), CONSTRAINT [Content should be formatted as JSON] CHECK...
SELECT s.name AS [schema], t.object_id AS [table_object_id], t.name AS [table_name], c.column_id, c.name AS [column_name], i.name AS [index_name], i.type_desc AS [index_type] FROM sys.schemas AS s INNER JOIN sys.tables AS t ON s.schema_id = t.schema_id I...

Page 4 of 9