Tutorial by Examples: at

This example uses the Cars Table from the Example Databases. UPDATE Cars SET Status = 'READY' This statement will set the 'status' column of all rows of the 'Cars' table to "READY" because it does not have a WHERE clause to filter the set of rows.
This example uses the Cars Table from the Example Databases. UPDATE Cars SET Status = 'READY' WHERE Id = 4 This statement will set the status of the row of 'Cars' with id 4 to "READY". WHERE clause contains a logical expression which is evaluated for each row. If a...
var a = Math.random(); Sample value of a: 0.21322848065742162 Math.random() returns a random number between 0 (inclusive) and 1 (exclusive) function getRandom() { return Math.random(); } To use Math.random() to get a number from an arbitrary range (not [0,1)) use this function to get a...
import operator reduce(operator.mul, [10, 5, -3]) # Out: -150
Extensions are used to extend the functionality of existing types in Swift. Extensions can add subscripts, functions, initializers, and computed properties. They can also make types conform to protocols. Suppose you want to be able to compute the factorial of an Int. You can add a computed property...
[0-9] and \d are equivalent patterns (unless your Regex engine is unicode-aware and \d also matches things like ②). They will both match a single digit character so you can use whichever notation you find more readable. Create a string of the pattern you wish to match. If using the \d notation, you...
CREATE INDEX ix_cars_employee_id ON Cars (EmployeeId); This will create an index for the column EmployeeId in the table Cars. This index will improve the speed of queries asking the server to sort or select by values in EmployeeId, such as the following: SELECT * FROM Cars WHERE EmployeeId = 1 ...
Exponentiation can be used by using the builtin pow-function or the ** operator: 2 ** 3 # 8 pow(2, 3) # 8 For most (all in Python 2.x) arithmetic operations the result's type will be that of the wider operand. This is not true for **; the following cases are exceptions from this rule: B...
The math-module contains another math.pow() function. The difference to the builtin pow()-function or ** operator is that the result is always a float: import math math.pow(2, 2) # 4.0 math.pow(-2., 2) # 4.0 Which excludes computations with complex inputs: math.pow(2, 2+0j) TypeErro...
Both the math and cmath-module contain the Euler number: e and using it with the builtin pow()-function or **-operator works mostly like math.exp(): import math math.e ** 2 # 7.3890560989306495 math.exp(2) # 7.38905609893065 import cmath cmath.e ** 2 # 7.3890560989306495 cmath.exp(2) # (...
The math module contains the expm1()-function that can compute the expression math.e ** x - 1 for very small x with higher precision than math.exp(x) or cmath.exp(x) would allow: import math print(math.e ** 1e-3 - 1) # 0.0010005001667083846 print(math.exp(1e-3) - 1) # 0.0010005001667083846 p...
Supposing you have a class that stores purely integer values: class Integer(object): def __init__(self, value): self.value = int(value) # Cast to an integer def __repr__(self): return '{cls}({val})'.format(cls=self.__class__.__name__, ...
A basic Employees table, containing an ID, and the employee's first and last name along with their phone number can be created using CREATE TABLE Employees( Id int identity(1,1) primary key not null, FName varchar(20) not null, LName varchar(20) not null, PhoneNumber varchar(10)...
A submodule references a specific commit in another repository. To check out the exact state that is referenced for all submodules, run git submodule update --recursive Sometimes instead of using the state that is referenced you want to update to your local checkout to the latest state of that s...
To check the equality of Date values: var date1 = new Date(); var date2 = new Date(date1.valueOf() + 10); console.log(date1.valueOf() === date2.valueOf()); Sample output: false Note that you must use valueOf() or getTime() to compare the values of Date objects because the equality operato...
Using the Cars Table, we will calculate the total, max, min and average amount of money each costumer spent and haw many times (COUNT) she brought a car for repairing. Id CustomerId MechanicId Model Status Total Cost SELECT CustomerId, SUM(TotalCost) OVER(PARTITION BY Cust...
Using the Item Sales Table, we will try to find out how the sales of our items are increasing through dates. To do so we will calculate the Cumulative Sum of total sales per Item order by the sale date. SELECT item_id, sale_Date SUM(quantity * price) OVER(PARTITION BY item_id ORDER BY sale...
When the Repeater is Bound, for each item in the data, a new table row will be added. <asp:Repeater ID="repeaterID" runat="server" OnItemDataBound="repeaterID_ItemDataBound"> <HeaderTemplate> <table> <thead> ...
Abbreviated from https://blogs.dropbox.com/developers/2013/07/using-oauth-2-0-with-the-core-api/: Step 1: Begin authorization Send the user to this web page, with your values filled in: https://www.dropbox.com/oauth2/authorize?client_id=<app key>&response_type=code&redirect_uri=<...
The trap is reset for subshells, so the sleep will still act on the SIGINT signal sent by ^C (usually by quitting), but the parent process (i.e. the shell script) won't. #!/bin/sh # Run a command on signal 2 (SIGINT, which is what ^C sends) sigint() { echo "Killed subshell!" } ...

Page 11 of 442