Tutorial by Examples: er

Use a subquery to filter the result set. For example this will return all employees with a salary equal to the highest paid employee. SELECT * FROM Employees WHERE Salary = (SELECT MAX(Salary) FROM Employees)
A subquery in a FROM clause acts similarly to a temporary table that is generated during the execution of a query and lost afterwards. SELECT Managers.Id, Employees.Salary FROM ( SELECT Id FROM Employees WHERE ManagerId IS NULL ) AS Managers JOIN Employees ON Managers.Id = Employees.Id ...
SELECT Id, FName, LName, (SELECT COUNT(*) FROM Cars WHERE Cars.CustomerId = Customers.Id) AS NumberOfCars FROM Customers
package main import ( "fmt" "io/ioutil" ) func main() { files, err := ioutil.ReadDir(".") if err != nil { panic(err) } fmt.Println("Files and folders in the current directory:") for _, fileInfo := range fi...
To access member variables and member functions of an object of a class, the . operator is used: struct SomeStruct { int a; int b; void foo() {} }; SomeStruct var; // Accessing member variable a in var. std::cout << var.a << std::endl; // Assigning member variable b in v...
Taking a complex JSON document in a table: CREATE TABLE mytable (data JSONB NOT NULL); CREATE INDEX mytable_idx ON mytable USING gin (data jsonb_path_ops); INSERT INTO mytable VALUES($$ { "name": "Alice", "emails": [ "[email protected]", ...
Every case class defines an extractor that can be used to capture the members of the case class when pattern matching: case class Student(name: String, email: String) def matchStudent1(student: Student): String = student match { case Student(name, email) => s"$name has the following...
You can require a generic type to extend multiple upper bounds. Example: we want to sort a list of numbers but Number doesn't implement Comparable. public <T extends Number & Comparable<T>> void sortNumbers( List<T> n ) { Collections.sort( n ); } In this example T must...
To keep a container running in the background, supply the -d command line option during container startup: docker run -d busybox top The option -d runs the container in detached mode. It is also equivalent to -d=true. A container in detached mode cannot be removed automatically when it stops, t...
A Docker volume is a file or directory which persists beyond the lifetime of the container. It is possible to mount a host file or directory into a container as a volume (bypassing the UnionFS). Add a volume with the -v command line option: docker run -d -v "/data" awesome/app bootstrap....
Auto-implemented properties were introduced in C# 3. An auto-implemented property is declared with an empty getter and setter (accessors): public bool IsValid { get; set; } When an auto-implemented property is written in your code, the compiler creates a private anonymous field that can only be...
You have started an interactive rebase. In the editor where you pick your commits, you decide that something is going wrong (for example a commit is missing, or you chose the wrong rebase destination), and you want to abort the rebase. To do this, simply delete all commits and actions (i.e. all lin...
Swift supports the creation of custom operators. New operators are declared at a global level using the operator keyword. The operator's structure is defined by three parts: operand placement, precedence, and associativity. The prefix, infix and postfix modifiers are used to start an custom op...
To get a verbose list of all devices connected to adb, write the following command in your terminal: adb devices -l Example Output List of devices attached ZX1G425DC6 device usb:336592896X product:shamu model:Nexus_6 device:shamu 013e4e127e59a868 device usb:337641472X produc...
Composer is a dependency/package manager for PHP. It can be used to install, keep track of, and update your project dependencies. Composer also takes care of autoloading the dependencies that your application relies on, letting you easily use the dependency inside your project without worrying about...
While composer provides a system to manage dependencies for PHP projects (e.g. from Packagist), it can also notably serve as an autoloader, specifying where to look for specific namespaces or include generic function files. It starts with the composer.json file: { // ... "autoload&q...
An alternative community de facto standard is an addon called ember-concurrency that makes a lot of the promise confusion go away. It can be installed with the command ember install ember-concurrency. Pros Intuitive reasoning of complex asynchronous code. Offers a complete API for managing tas...
To find out the IP address of your container, use: docker inspect <container id> | grep IPAddress or use docker inspect docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${CID}
ActionScript 3 can be used by installing the Adobe AIR SDK or Apache Flex SDK or as part Adobe's Animate CC product (formerly known as Flash Professional). Adobe Animate CC is a professional software solution that can be used to create AS3 projects using visual tools - once installed, no further st...
1 + 2 # Addition 1 - 2 # Subtraction -1 # Set negative value 1 * 2 # Multiplication 1 / 2 # Division 1 % 2 # Modulus 100 -shl 2 # Bitwise Shift-left 100 -shr 1 # Bitwise Shift-right

Page 42 of 417