What happens when you JOIN two tables together without an ON clause?
5 phương ánCó giải thích
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Đáp án đúng: "The number of rows you get is the number of rows in the first table times the number of rows in the second table". JOIN không có ON thì không có điều kiện ghép, nên SQLite ghép mọi dòng bảng trái với mọi dòng bảng phải, tạo tích Đề-các (Cartesian product), tương đương CROSS JOIN: bảng 3 dòng ghép bảng 4 dòng cho 12 dòng. Mệnh đề ON chính là bộ lọc giữ lại những cặp có khoá ngoại khớp khoá chính. "The rows of the left table are connected to the rows in the right table when their primary key matches" mô tả JOIN có ON, ví dụ ON Track.album_id = Album.id. "You get no rows at all" sai vì thiếu điều kiện thì mọi cặp đều được giữ chứ không cặp nào bị loại. "You get all of the rows of the left table in the JOIN and NULLs in all of the columns of the right table" gần với kết quả của LEFT JOIN khi không có dòng nào khớp, không phải trường hợp này. "Leaving out the ON clause when joining two tables in SQLite is a syntax error" sai vì SQLite cho phép JOIN không ON và coi như CROSS JOIN.
Cùng phần 4
What is the default sorting mode of the ORDER BY clause?Có lời giảiCâu hỏiWhich of the following is the database software used in this class?Có lời giảiCâu hỏiWhich is the correct command for a statement that will select data from the Breed column in the Cats table?Có lời giảiCâu hỏiCả 36 câu của chủ đề36 câu
Xuất hiện trong 1 bộ đề
Đi tiếp từ đây