Can you give examples when using foreign keys is not advisable?
Golang
Look at the database schema above — what can be added, or is everything fine?
Can we get a link/address to a specific map element?
How would you solve the problem of loading a million users into memory (risk of memory and delay)?
-- Display all books and their authors/co-authors in a simple tabular format. -- Example: -- book_name | author_name -- --------------------|------------- -- Master and Margarita | Igor -- Eugene Onegin | Ivan
-- List authors who have no books.
Does the variable capture problem in a goroutine depend on the Go version?
We want to get only active users, but what is wrong with the isActive filter?
What can you say about the output of this program?
-- List all authors and the number of their books. -- Example: -- author_name | book_count --------------------------- -- Igor | 2 -- Ivan | 1 -- List authors who have written more than 2 books.
package maptask import "fmt" import "time" func Foo() { data := make(map[int]bool) for i := 0; i < 10; i++ { go func() { data[i] = true }() } time.Sleep(time.Second * 1) for k, v := range data { fmt.Println(k, v) } }
Why is a regular map in Go unsafe for concurrent writes?
What index should we use if we want to search by book title?
What are maps in Go?
What if you need to search by part of the book's title (substring)?
Where would you start implementing pagination in this method?
What are other ways to protect a map from concurrent access besides mutex?
Maybe you can suggest something else besides Mutex and sync.Map for record protection?
What is the name of the WITH ... AS (...) construction on line 84 of the query?
-- List all books and their authors/co-authors in a simple tabular form. -- Example: -- book_name | author_name -- --------------------|-------------- -- Master and Margarita | Igor -- Eugene Onegin | Ivan -- List all authors and the number of their books. -- Example: -- author_name | book_count -- ------------|----------- -- Igor | 2 -- Ivan | 1