A shooting at a school in Highlands Ranch, Colo., on Tuesday in which one student was killed and eight others were injured swiftly drew comparisons to the 1999 attack on nearby Columbine High School and the dozens of shootings like it in the years since.

The attack was the fourth such school shooting in the Denver area and at least the 111th in the country since 1970, according to a New York Times analysis — the latest in a decades-long series of violent episodes that have shocked the nation and traumatized generations of students.

The Times examined hundreds of episodes in a database of shootings at elementary, middle and high schools to identify those cases where, like at Highlands Ranch and Columbine, the assailants planned their attacks and fired indiscriminately.

Deaths and injuries in active-shooter attacks on K-12 schools since 1970 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 A champion rifle team member fired at random targets from the windows of a New York high school. 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 A massacre at a Stockton, Calif., elementary school led to the nation's first assault weapons ban. 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 Two students, one of whom pulled a fire alarm, shot classmates as they fled an Arkansas middle school. Columbine 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 A shooter at Santana High School outside San Diego carefully planned his attack. Students heard him make veiled threats before the attack. 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 Benton Sandy Hook Parkland Santa Fe 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 Stockton 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 Columbine 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 Benton Sandy Hook Parkland Santa Fe 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 Stockton 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 Columbine 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 Benton Sandy Hook Parkland Santa Fe 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 Stockton 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 Columbine 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 Sandy Hook 2015 2016 2017 2018 2019 Benton Parkland Santa Fe

A total of 202 people were killed in these attacks and 454 were injured, including the shooters. In 16 cases, shots were fired but no one was injured.

Last year was particularly violent: 29 people were killed and 48 were injured in three shootings in Parkland, Fla.; Sante Fe, Tex.; and Benton, Ky.

Shootings of this type are rare relative to the larger universe of gun violence at schools, but they are common enough that lockdown drills and “run, hide, fight” exercises are part of the school experience all over the country. Before Highlands Ranch there was Marjory Stoneman Douglas. Before Marjory Stoneman Douglas there was Sandy Hook. Before Sandy Hook, Columbine, and before Columbine, Cleveland Elementary in Stockton, Calif.

Active-shooter attacks on schools each year 7 attacks At least one injury No injuries 1970 1975 1985 1995 1980 1990 2000 2005 2010 2015 2019 No injuries At least one injury 7 attacks 1970 1980 1990 2000 2010 2019 At least one injury No injuries 7 attacks ’70 ’80 ’90 ’00 ’10 ’19

The school shootings database, compiled by the Naval Postgraduate School’s Center for Homeland Defense and Security, is the most comprehensive and detailed of its kind. Researchers aimed to document all instances of gunfire at K-12 schools since 1970 and recorded a total of more than 1,300 cases. The database does not include shootings on college campuses.

The Times’s analysis identified the 111 cases that met the F.B.I.’s definition for an active-shooter scenario, in which an assailant is actively engaged in killing or attempting to kill people, on school property or inside school buildings. It excluded episodes that fit more typical patterns of gun violence such as targeted attacks, gang shootings and suicides.

Locations of active-shooter attacks at schools since 1970 Me. N.D. Mont. Vt. S.D. Highlands Ranch shooting Fourth in Denver area since Columbine Iowa N.J. Del. W.Va. Ala. Hawaii Me. N.D. Mont. Vt. S.D. Iowa N.J. Highlands Ranch shooting Fourth in Denver area since Columbine Del. W.Va. Ala. Hawaii Me. N.D. Mont. Vt. S.D. Highlands Ranch school shooting Iowa N.J. Del. W.Va. Ala. Hawaii Me. Mont. N.D. Vt. S.D. Highlands Ranch school shooting Iowa N.J. Del. W.Va. Ala. Hawaii

These events have stunned much of the country and, in the case of the Parkland shooting, inspired a national student-led movement to tighten the nation’s gun laws. But they account for only a small fraction of the episodes of gun violence that children experience in American schools.

Other cases might include a student showing off a gun to friends in the hallway, the accidental discharge of a school resource officer’s gun, or a gang-related drive-by shooting at a school bus stop.

“There are shootings that occur in very wealthy counties and very poor counties, ones that happen in very diverse areas and very homogenous areas,” said David Riedman, a co-creator of the database.

Active shooters may attack anywhere, but a demographic analysis shows they tend to have traits in common. The majority of shooters were young white men or boys, many of them current or former students of the schools where they opened fire.

Most of the shooters were white boys or young, white men Age 10 15 20 25 30 40 45 19 shooters White males Other Unknown Most shooters were students or former students Age 10 15 20 25 30 35 40 45 50 19 shooters White males Others Unknown Most shooters were students or former students Age 10 15 20 25 30 35 40 45 50 19 shooters White males Others Unknown Most shooters were students or former students Age 10 15 20 25 30 35 40 45 50

Some shooters followed a now-familiar blueprint. Peter Langman, a psychologist who studies school shooters, said younger assailants are especially likely to find inspiration in earlier events. “More than anyone else, people cite the Columbine killers,” Mr. Langman said.

That episode intensified a debate over gun violence that continues to divide the nation and drove districts to allocate hundreds of millions of dollars to “harden” schools against threats.

The Highlands Ranch shooting similarly renewed old questions about gun access and how best to protect students from shootings. At a vigil for the victims on Wednesday, Colorado’s senior senator criticized the country’s gun laws.

Mr. Riedman, who spent hours poring over news reports and public records on hundreds of shootings to build the database, said school safety measures should take into account not only the incidents like Columbine but also the many other ways guns and schools can intersect in America.