The second Democratic presidential debates will take place in just more than a week, this time in Detroit. After what transpired in Miami, almost every candidate has something to prove.

CNN, which will host the two nights of debate, found a smart system to assure relative balance between upper and lower-tier candidates on each night. That will create opportunities and dynamics on both nights that will differ in important ways from the two nights in Miami.

Among the candidates in the upper tier of the polls, Sen. Elizabeth Warren of Massachusetts and Sen. Bernie Sanders, I-Vt., will join eight other candidates on July 30, while former Vice President Joe Biden and Sen. Kamala Harris of California will join the eight remaining qualifiers on July 31.

For Harris and Biden, who clashed in Miami, this represents a rematch. Warren and Sanders, the two leading progressives in the contest for the Democratic nomination, share many ideas in common but this will mark the first time they have shared a debate stage.

Much of the attention already is focused on what these two pairings will produce, substantively, stylistically and politically. Yet the other 16 candidates won’t be potted plants, no matter how much the CNN moderators seek to pit the leaders against one another. For many of those 16, the stakes are especially high, in part because some of them might not meet the current rules for qualifying for the September debate in Houston.

Biden needs a bounce back after Miami. Not only was he hit hard by Harris over his opposition to mandatory school busing in the 1970s and his comments about working with segregationist senators decades ago, his overall performance lacked spark, crispness and energy, all encapsulated by his unfortunate comment, “My time is up. I’m sorry.”

Biden can expect more criticism in Detroit. It could come from Harris, but it could just as easily come from Sen. Cory Booker of New Jersey. Booker told The Post’s Robert Costa during an interview before a live audience last week that the 1994 crime bill that Biden helped steer to passage was one of the worst pieces of legislation ever. An exchange over that issue appears inevitable.

Harris might be happy to let Booker take the lead against Biden, assuming that Booker does not challenge her. She had her moment in Miami, a well-planned and well-executed attack that accomplished, at least in the short term, what she had wanted. But she also has drawn more scrutiny on her positions on other issues. Taking on Biden again might not serve her best interests.

Still, she must be prepared. If the former vice president comes after her, on health care or the busing controversy, there will be an unavoidable second round between the two. Given that she’s trying to argue that she is equipped to prosecute the case against President Donald Trump in 2020, Harris will have to demonstrate that she can counter effectively when attacked. A perpetuation of the Biden-Harris dynamic of Miami carries as many risks as rewards.

If Biden is set up for a bounceback, much still depends on his ability to deliver. He continues to offer uneven performances on the campaign trail.As the person atop the state and national polls and as someone who has run for president twice previously, and as the person who ran two general elections as Barack Obama’s running mate, and as the candidate who claims to have the best chance of defeating Trump in 2020 — expectations for Biden are higher. Still, it should not be difficult to have a better night the second time around.

Warren made the most of not having to share the stage in Miami with Biden, Sanders or Harris. Her discipline and her skill at delivering her own message were on display. She took advantage when she was in the spotlight and seemed content to stay out of other scrums.

She and Sanders are friends of many years and have similar perspectives, if sometimes different solutions, about what they see as an economic and political system rigged against the middle class. It’s likely they will be encouraged by one of the CNN moderators to point out their differences. Warren might decide to avoid engaging or deflect questions back to issues she wants to highlight. But will Sanders, who has lost some ground, be content to do the same?

First-night friction almost certainly will come from others on the stage. Several of them have moderate views they will want to contrast with Warren and Sanders. One is former Colorado Gov. John Hickenlooper, who has been outspoken about the leftward movement of the party and who knows he needs a spark for his candidacy. Former Rep. John Delaney of Maryland is another, given what he did in Miami. Sen. Amy Klobuchar of Minnesota has cast herself as a results-oriented politician who thinks the progressives are offering some unrealistic proposals. But she has been gentle in making that point.

Two others who will debate on the first night could have agendas other than getting into a scrap with Warren and Sanders, or the others.

South Bend, Ind., Mayor Pete Buttigieg is running close to the leading four in polls in Iowa and New Hampshire, but nationally is further back. He has shown a desire to push forward his own ideas, to highlight his profile (younger generation, military veteran), and not to pick fights.

Former Rep. Beto O’Rourke of Texas had a poor night in Miami, consistent with a disappointing run since he announced his candidacy. He is passionate on the campaign trail and continues to display skills as a retail candidate. But he has been on a downward trajectory. He lacked focus in the first debate and will feel the pressure to step up in Detroit. Does it serve him to try to make a moment by attacking a rival or simply to deliver a tighter and sharper message in his own behalf?

The same can be said for Gov. Steve Bullock of Montana. He did not qualify for the Miami debate, so this will be his moment of introduction to most viewers. He hopes to impress Democratic voters by highlighting that he won reelection in 2016 in a red state and produced some progressive results. He’s not yet tied those points to a larger national message about the direction of the Democratic Party.

Rep. Tim Ryan of Ohio, an advocate for economic policies aimed at working-class voters, will also debate on the first night, as will author Marianne Williamson.

The second night will include every candidate of color in the race. It also will feature several candidates struggling to get attention, Sen. Michael Bennet of Colorado, Washington Gov. Jay Inslee and Sen. Kirsten Gillibrand of New York among them.

Bennet, a moderate, took on Biden in Miami. Will he do that again or focus more on his concerns that the Democrats are in danger of being defined out of the mainstream? Gillibrand repeatedly and energetically sought to inject herself into the Miami debate, but with limited success. Inslee is the climate change candidate but didn’t make much of a mark in Miami.

New York Mayor Bill de Blasio stood out in Miami through his interruptions and by asserting his progressive credentials. But it hasn’t helped him much with Democratic voters.

Former housing secretary Julián Castro benefited from his exchange in Miami with O’Rourke over immigration. The Miami debate helped raise his profile and some badly needed funding. Will he look at Biden and Harris as fresh opportunities for contrast?

In the first debate, Castro pushed the other candidates to embrace his plan to decriminalize the border. He’ll be asked to defend that and rebut the charge that it leaves Democrats open to the label of the “open borders” party.

The second night also will include Rep. Tulsi Gabbard of Hawaii and entrepreneur Andrew Yang.Democratic voters are looking for the person they believe can defeat Trump and are measuring the candidates through that lens. That means it’s not necessarily in the candidates’ interest at this point to get into fights with each other. They do need to present an appealing rationale for why they are seeking the presidency, to show a combination of character and message that sets them apart from and above their rivals.

However, CNN has sponsored many debates and the network’s style is to prod and provoke the participants to clash with one another. That suggests Detroit could be even noisier and more contentious than Miami.